Re: Re: Sharing a model
Re: Re: Sharing a model
- Subject: Re: Re: Sharing a model
- From: Marc Respass <email@hidden>
- Date: Tue, 15 Feb 2011 11:50:08 -0500
> I had not designed my program as a document-based application because I did not think that I would save and open data files. However, I have changed my viewpoint. It might also make implementing your suggestions easier.
>
Keep in mind that in an NSDocument-based application, your NSDocument subclass *is* the model. You can have multiple windows all looking at the same model. You can get the document from the window's controller and the window from any view in the window. If your custom view is controlled by an NSViewController then from the view controller,
id model = [(MyDocument *)[[[[self view] window] windowController] document] model];
Although I don't recommend that in regular use, there is a connection. The default project for an NSDocument-based app hides the fact that the document is the model and the window is simply a view into the model. Setting up to use more than one window exposes it but it's a really cool feature. You might want your graphic view in another window or in a floating window and it'll all be tied in to the same underlying model.
Marc
_______________________________________________
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