Re: 'Static' items in an NSOutlineView
Re: 'Static' items in an NSOutlineView
- Subject: Re: 'Static' items in an NSOutlineView
- From: Quincey Morris <email@hidden>
- Date: Tue, 18 Oct 2011 12:21:11 -0700
On Oct 18, 2011, at 05:20 , Koen van der Drift wrote:
> when my app starts the first time, I would like to have the
> outline view be prepopulated with a few groups: LIBRARY, FAVORITES,
> RECENT and maybe Group1 (a child of LIBRARY). I did all that, but did
> not add Group1 to be a child of LIBRARY, so I will do that too. Am I
> correct in doing this through an NSFetchRequest, for an entity
> @"Group" with a predicate @"Library"?
You'd probably be better off finding all of your "special" group objects when your app first accesses an existing persistent store, and keeping the pointers in instance or static variables. But you can fetch them on demand if you want.
> Do you mean that if I create the 'static' items in the order I want
> them to be displayed (LIBRARY - FAVORITES - RECENT), that's the order
> in which they always will be displayed?
We're talking about Core Data, right? Objects in a Core Data persistent store have no intrinsic order, though they can be indexed on one of their properties.
Unfortunately, I've forgotten (if I ever knew) how you were approaching all this. The existence of these special top-level groups, plus the complication of Core Data, means that simply binding a NSTreeController to *a* data model is too inflexible. As I said before, in situations like this, you really want an intermediate data model.
_______________________________________________
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