Re: Core Data and multiple NIBs: how to share the managedObjectContext?
Re: Core Data and multiple NIBs: how to share the managedObjectContext?
- Subject: Re: Core Data and multiple NIBs: how to share the managedObjectContext?
- From: zeno <email@hidden>
- Date: Fri, 12 Aug 2005 10:53:12 +0200
On 8/11/05, Charilaos wrote:
> The question is who is the File's owner of Details.nib. The nib
> communicates with the outside world either through File's owner, or
> through the first responder chain, and the latter will not work for
> you. So when you create Details.nib in your code, and you set its
> owner, then that object is what you can connect or bind to through
> the File's owner instance in the nib. You'll just have to arrange for
> that object to be able to provide you with the information you want.
Yeah, I know the key point to communicate between NIBs is the File's
Owner, in fact, what I did is that I added a method
-(NSManagedObjectContext *)managedObjectContext; to MainController
(which is actually the File's Owner of Details.nib) and implemented
like this:
- (NSManagedObjectContext *)managedObjectContext
{
return [[NSApp delegate] managedObjectContext];
}
Then I copied the "Items" array controller from MainMenu.nib, pasted
it into Details.nib and I bound its managedObjectContext property to
"File's Owner (MainController)" using "managedObjectContext" as Model
Key Path.
Now, that actually works when I launch the application (the textfield
in Details.nib shows the value based on the selected (first) row of
the tableview in MainMenu.nib), but then when I change selection in
the table view the textfield doesn't update anymore...
sorry I'm a Core Data newbie...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden