Re: Apple's NSPersistentDocument Tutorial and MOCs
Re: Apple's NSPersistentDocument Tutorial and MOCs
- Subject: Re: Apple's NSPersistentDocument Tutorial and MOCs
- From: Keary Suska <email@hidden>
- Date: Wed, 12 Nov 2008 18:24:58 -0700
On Nov 12, 2008, at 4:38 PM, Brad Gibbs wrote:
This works fine for attributes, but I'd also like to create
relationships between the new product and existing category and
manufacturer objects in the main MOC using pop up buttons. I can
populate the pop up buttons easily enough in IB using bindings, but
I can't bind across from the main MOC where the categories and
manufacturers arrays live into the special new product MOC created
for the sheet.
I've mucked about a bit with NSPopUpButton's titleForSelectedItem
and some other methods, but, it feels as though I'm fighting the
frameworks. Can someone recommend an elegant solution for this?
Since both MOCs should be using the same persistent store, you can
"fetch" the related entities into the temporary MOC. This is probably
easier than copying them, which would be another alternative.
You might save yourself some headache by using the MOC's undoManager
instead of creating a temporary MOC. To do this, get the undo manager,
begin an undo grouping. When the sheet is dismissed, end the undo
grouping. If the user canceled the sheet, call -undoNestedGroup. This
should work both for additions and edits. Works like a charm for me,
so far at least.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden