• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fastest way to check for descendants of an object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Fastest way to check for descendants of an object (From: Keith Blount <email@hidden>)
 >Re: Fastest way to check for descendants of an object (From: Mike Abdullah <email@hidden>)
 >Re: Fastest way to check for descendants of an object (From: Keith Blount <email@hidden>)

  • Prev by Date: Re: menu madness with retain count
  • Next by Date: Re: white screen windows at first
  • Previous by thread: Re: Fastest way to check for descendants of an object
  • Next by thread: Re: Fastest way to check for descendants of an object
  • Index(es):
    • Date
    • Thread