Re: NSTreeController, Core Data and root objects
Re: NSTreeController, Core Data and root objects
- Subject: Re: NSTreeController, Core Data and root objects
- From: Rob Keniger <email@hidden>
- Date: Fri, 6 Nov 2009 10:40:34 +1000
On 06/11/2009, at 5:38 AM, Fritz Anderson wrote:
> Here is what I did, for a small tree: My document keeps the root object as a KVO property -- I do not rely on a fetch.
>
> I declare classes for my tree-element entities. so I could implement a method, -(NSArray *)orderedChildren, to return the "children" set, sorted as needed.
>
> I exposed the document (and thus, indirectly, the root) through an NSObjectController.
>
> I bound the tree controller's content _array_ to that root object's orderedChildren key. (Document NSObjectController -> root.orderedChildren). Members of the content array appear as top-level nodes in the outline.
>
> My tree has constant structure, so I can't make any comment on mutation.
Hi Fritz,
Thanks for this pointer. Unfortunately, while this works great for a static tree, it fails when you try to mutate the tree objects. :-/
--
Rob Keniger
_______________________________________________
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