Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programatically bind NSArrayController to NSManagedObjectContext?




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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Programatically bind NSArrayController to NSManagedObjectContext? (From: Jerry Krinock <email@hidden>)
 >Re: Programatically bind NSArrayController to NSManagedObjectContext? (From: mmalc crawford <email@hidden>)
 >Re: Programatically bind NSArrayController to NSManagedObjectContext? (From: Jerry Krinock <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.