On 16/06/2008, at 5:42 AM, Hamish Allan wrote:

On Sun, Jun 15, 2008 at 11:42 AM, Steven Hamilton <[EMAIL PROTECTED]> wrote:

I've been a busy bee learning Cocoa and core data (as my frequent postings may reveal) and now I wish to add NSPersistentDocument functionality. I started my project using the normal Core Data template so how do I change my program to use the NSPersistentDocument model instead of the standard bare
Core Data template?

That would depend on what you mean by "add NSPersistentDocument
functionality". Usually, the VC of the MVC will be different enough in
a document-based app as opposed to a non document-based app that it
will be easier and cleaner to just create a new document-based project
and copy the files for those parts of the model (and maybe controller)
you wish to remain the same.

Righty. I've read up Document based architecture and through the NSPersistentDocument tutorial and class references. I've decided to do as you say and create a new project and sutbly move my code and nib files over. Since my document is multi-window based I need to subclass NSDocument (done) and NSWindowControllers, one controller for each window in the document. So far so good. What I don't understand is how to bind to the managedObjectContext. As far as I can tell in each windows .nib file I set File's Owner to be my subclassed WindowController. This doesn't contain the MOC so therefore I can't bind to it. NSDocument has the MOC but that isn't available in the list of bindable objects. Do I have the design wrong here? Should I set my subclassed windowcontrollers to be each nibs FilesOwner? How do I reach the managedObjectContext?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to