How does NSArrayController bind to data model from IB?
How does NSArrayController bind to data model from IB?
- Subject: How does NSArrayController bind to data model from IB?
- From: Mike - <email@hidden>
- Date: Sun, 3 Jun 2007 13:07:40 -0700 (PDT)
Hello,
Sorry in advance if this is a FAQ, but after several hours of reading documentation and the list archives as well as hands-on coding, I still haven't been able to figure this one out.
Short version: How does an NSArrayController in IB "see" entities in a data model (when I enter an attribute value for "Entity Name")?
This would seem to be linked to a managed object context, but I can't figure out how this is wired up.
Background: The CheckIn sample app (http://developer.apple.com/cocoa/coredatatutorial/index.html) is a Core Data Document-based Application. I'm trying to replicate this with a regular Core Data Application because I'm building a single-window interface.
CheckIn's MyDocument.nib has an NSArrayController named ReleasesController. Its specified entity is "VersionRelease," which is modeled in MyDocument.xcdatamodel. Its managedObjectContext is bound to File's Owner (MyDocument). In the UI under Bindings for the table view's corresponding column, ReleasesController is selected and under Model Key Path I can see the list of attributes from the VersionRelease entity modeled back in XCode.
When I try to replicate this in my Core Data application I can't browse the attributes for Model Key Path in the same way. IOW it doesn't seem to "see" the model attributes through the controller.
There does seem to be some magic provided by NSPersistentDocument, so I have my File's Owner inheriting from a subclass of this class (called MainDocument).
When creating a document-based application like CheckIn, the data model and document nib are created by default, but I'm trying to replicate this in a vanilla Core Data project by adding the nib and data model manually.
So my basic question is: how are entities created in a data model in XCode automatically exposed to controllers in IB, as in the CheckIn application?
Thanks.
---------------------------------
Boardwalk for $500? In 2007? Ha!
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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