Re: Programatically bind NSArrayController to NSManagedObjectContext?
Re: Programatically bind NSArrayController to NSManagedObjectContext?
- Subject: Re: Programatically bind NSArrayController to NSManagedObjectContext?
- From: mmalc crawford <email@hidden>
- Date: Sun, 30 Sep 2007 17:40:56 -0700
On Sep 30, 2007, at 4:36 PM, Jerry Krinock wrote:
[arrayController setManagedObjectContext:xxx] ;
[arrayController setEntityName:yyy] ;
[arrayController prepareContent] ;
NSManagedObjectContext is not listed in the Cocoa Bindings
Reference [1]. Is this really a "binding", or is it something
else? The documentation for binding NSArrayController
'managedObjectContext' in [1] calls it "registered with".
It's not clear what this means.
Bindings are bindings.
Well, I would say that the code I entered above is not a binding
because it does not, and could not, invoke
bind:toObject:withKeyPath:options
It's again not clear what this means.
The code you wrote above is, obviously, not a binding -- you're
setting the managed object context directly using an accessor method.
You can, however, bind the 'managedObjectContext' binding of
controllers -- it is common(*), for example, in a document-based
application to bind it to [TheDocument].managedObjectContext.
If you wanted to do this in, say, the implementation of
windowControllerDidLoadNib in a subclass of NSPersistentDocument it
would look like:
[arrayController bind:@"managedObjectContext"
toObject:self
withKeyPath:@"managedObjectContext"
options:nil] ;
(*) Largely because it's easy to do and code-free..
mmalc
_______________________________________________
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