Re: Sharing a model
Re: Sharing a model
- Subject: Re: Sharing a model
- From: Kyle Sluder <email@hidden>
- Date: Sun, 13 Feb 2011 22:35:35 -0800
On Sun, Feb 13, 2011 at 9:27 PM, Graham Cox <email@hidden> wrote:
>> 3. When should the reference to the model be set up in each controller?
>
> It will be done for you when the document is created from the nib. All you need to do is populate the model from the file when the file is opened. NSDocument provides an override for that.
I think it's worth being pedantic here, given some recent confusion:
The document itself (your NSDocument instance) doesn't live in the
nib. It will *load* its nib, or an NSWindowController will do so on
its behalf. But it will already exist before the nib is unfrozen.
Sometimes people get confused and drop an NSDocument instance into the
nib window, thinking that it should be created along with the rest of
the document-related objects. Then they wind up with two NSDocument
instances, one of which is hooked up to all the interface objects and
controllers, while NSDocumentController only knows of the other one.
--Kyle Sluder
_______________________________________________
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