My goal is to have an NSOutlineView (Source List style) that contains group items at it's root with each group item corresponding to a Core Data entity type (which I'll hard code, it doesn't need to automatically adapt to new entity types). I'd then like those group items to contain leaves for every instance of the corresponding entity in my object graph. For example: Foos [hard coded group item] - Foo 1 - Foo 2 Bars [hard coded group item] - Bar 1 - Bar 2
I've found numerous threads on similar topics but so far every approach I've tried has tripped me up at some point. I tried making my entities inherit from an abstract leaf entity and using an NSTreeController in entity mode with that entity. I hesitate to continue down that path because I don't like having to change my model just to get the view working. I also tried rolling my own data source for NSOutlineView based on the data source example at CocoaDev. Each node (group or leaf) is an NSMutableDictionary but I stumbled when it came to adding the entities. Creating a new object with a given title is fine but how do I obtain the actual entity instance from that title? Should I add the entity as a value in the dictionary item? I've also tried having a separate model for the NSTreeController but again I couldn't quite figure out how to map a leaf node to the entity instance I actually care about. Do I add a binary data attribute to my Leaf entity and somehow map that to an entity instance? Do I merge the models at runtime and add a relationship from one model to the other? I get the feeling all three approaches will work but I don't know for sure. I'd really appreciate a gentle steer towards a single approach or some help with the aforementioned tripping points! Thanks in advance, Matthew _______________________________________________ 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 arch...@mail-archive.com