Bindings and Collections
Bindings and Collections
- Subject: Bindings and Collections
- From: Kiel Gillard <email@hidden>
- Date: Sun, 4 Dec 2005 18:22:47 +1100
Hi all!
I am starting to come to terms with Cocoa bindings. I am not using
Core Data at the moment, just establishing my skills with bindings
first. I am wondering how to allow my NSArrayController or
NSTreeController to add objects to it's collection that are of a
different class.
For example, I would like to have an NSOutlineView such as the one in
Mail and in iTunes, where a user can group child objects in their
desired fashion. Currently, I have a NSTreeController and a
NSOutlineView that allows me to build a tree of unrestricted depth
where each object is an instance of a single kind of class.
I would like the tree to terminate after the second level (ie: Group
x > {Leaf 1, Leaf 2... Leaf n}). I have a feeling that all I need to
do is specify and implement a leafKeyPath accessor method (or maybe
all I will need to do is set the childrenKeyPath value) to restrict
the depth of my tree.
I would also like the class of the leaf objects to be of a different
class to that of a group object. But how do I tell my
NSTreeController to add an object of a specific class to the
selectedObject's leaf item array when the selectedObject is a Group
item? Do I override newObject or do I send the controller a
setObjectClass: message if the selection of the outline view is, or
changes to, an object of the Group class?
Any help would be much appreciated! Thank you and please forgive my
n00bness :-)
Kiel :-)
"Every minute spent angry is sixty seconds of happiness wasted."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden