Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?
Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?
- Subject: Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?
- From: Charles Srstka <email@hidden>
- Date: Wed, 11 Jun 2008 20:10:51 -0500
On Jun 11, 2008, at 6:57 PM, Ken Thomases wrote:
From the -[NSTreeController arrangedObjects] documentation:
Returns a proxy root tree node containing the receiver’s sorted
content objects.
- (id)arrangedObjects
Discussion
This property is observable using key-value observing.
Special Considerations
Prior to Mac OS X v10.5 this method returned an opaque root node
representing all the currently displayed objects. This method
should be used for binding, no assumption should be made about what
methods this object supports.
In general, you should not treat NSController-derived classes as
holders of data. They are specifically for binding to.
Since the "shapeTreeController" gets its content by binding to
something else, why don't you just directly access that something
instead of trying to go through the controller? In other words,
access your model, not your controller.
That's what I used to think, too, until someone on this list pointed
out to me that this snippet is in the header for NSTreeController:
// proxy for the root tree node responds to -childNodes and -
descendantNodeAtIndexPath:(NSIndexPath *)indexPath
- (id)arrangedObjects;
So whereas prior to 10.5 this method returned an opaque root node, in
Leopard you at least are promised that it will respond to -childNodes
and -descendantNodeAtIndexPath:.
Charles_______________________________________________
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