How to observe NSTreeController in a custom view?
How to observe NSTreeController in a custom view?
- Subject: How to observe NSTreeController in a custom view?
- From: "Oleg Krupnov" <email@hidden>
- Date: Fri, 5 Sep 2008 09:10:06 +0300
In the samples I have seen, custom views observe linear arrays
(NSArrayControllers). When the observeValue:forKey: message is sent to
the custom view, it checks what happened to the array. Because the
change dictionary does not help in this case, the view has to maintain
a copy of the previous array, so that by comparing the old and new
arrays, the view can tell the difference. This by the way looks quite
lame, isn't there a better way?
However I am having a really hard time trying to figure out how an
NSTreeController would work in this case by analogy. The
NSTreeContoller is also bound to the view via its "arrangedObjects"
property, which is in the case of trees "a proxy root tree node
containing the receiver's sorted content objects". Am I supposed to
maintain a copy of this node to make comparisons and tell the change
difference, like with arrays? If this is the case, how am I supposed
to traverse this root node, isn't it opaque? I've noticed the
NSTreeNode class, but it doesn't look connected to anything in the
docs...
Also I wonder what "arranged" means in the case of trees. Are the
siblings nodes arranged in each "folder" separately, or there is some
kind of global sort?
_______________________________________________
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