• 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
Bindings and Collections
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Bindings and Collections
      • From: Phil Frost <email@hidden>
  • Prev by Date: Re: changing brightness and contrast in an nsimage
  • Next by Date: Re: CoreData - large data set is slow to load on app launch - optimisation tips?
  • Previous by thread: Re: Is it possible to control "returnCode" value when using Custom Sheet?
  • Next by thread: Re: Bindings and Collections
  • Index(es):
    • Date
    • Thread