Re: Fastest way to check for descendants of an object
Re: Fastest way to check for descendants of an object
- Subject: Re: Fastest way to check for descendants of an object
- From: Quincey Morris <email@hidden>
- Date: Tue, 27 Apr 2010 10:25:19 -0700
On Apr 27, 2010, at 09:39, Keith Blount wrote:
> Many thanks for the reply, much appreciated. That makes sense - the only (or rather difficulty) is ensuring the node always has an up-to-date reference to its parent given the number of scenarios in which it could change (for instance, if a node is copied etc).
Take a look at NSTreeNode to give you the tree structure with no work on your part. You could either use its representedObject property to hold a pointer to your MyNode objects (having removed their own parent/child properties), or subclass NSTreeNode as MyNode.
One extra advantage of using NSTreeNode is that it's already properly KVO compliant, which is important if you're going to bind an outline view to your tree. Was your home-grown implementation already KVO compliant? :)
_______________________________________________
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