On Dec 5, 2009, at 6:11 PM, Jason Foreman wrote:

>       [[treeController arrangedObjects] childNodes];
> 
> Iterate over this collection and find nodes where [node representedObject] is 
> equal to your newly inserted objects.  Then you can pass this NSTreeNode 
> instance to -[NSOutlineView exandItem:].
> 
> This isn't terribly clean, and it might fall down if you have a large number 
> of items in your tree controller, but it works for what I need and might work 
> for you.

Thanks, Jason.

Unfortunately, the content can still be fairly large, so I’m not sure about how 
the performance of a brute force method like this will be. On the other hand, 
premature optimization is the root of all evil, and this is really easy to 
implement. It might not be a bad idea to just do this for now, don’t worry 
about the inefficiency, see how it works for the content sizes that a human 
could deal with, and just revisit the question if it ends up being a practical 
problem.

So if anybody has a cleaner solution (which I’m guessing by the silence they 
don’t), I’m all ears. Otherwise I’ll try this, and just fall back to rewriting 
NSTreeController myself if the performance doesn’t work out. (Is there any open 
source NSTreeController reimplementation out there?)

Best,
Benjamin Rister_______________________________________________

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

Reply via email to