• 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
Re: NSTreeController / CoreData still broken in 10.5?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTreeController / CoreData still broken in 10.5?


  • Subject: Re: NSTreeController / CoreData still broken in 10.5?
  • From: Chris Hanson <email@hidden>
  • Date: Sun, 23 Mar 2008 19:08:43 -0700

On Mar 23, 2008, at 4:55 PM, Adam Gerson wrote:
A specific question:

It is always good to ask specific questions. "Is ____ still broken in 10.5?" is not a very specific question, especially since there may be a number of developers who are using it quite successfully in Mac OS X 10.4.


If I want to model parent and child entities that have a
completely different set of attributes (one is a group of objects, the
other is the objects themselves) am I better of not using
NSTreeController and CoreData?

NSTreeController and Core Data are entirely orthogonal here -- specifically, Core Data has nothing at all to do with your question. Your question would be the same regardless of whether Core Data is involved.


One problem I have already run into is
that when you bind your entire OutlineView column to a
NSTreeController entity it wants the parents and children to all have
the same attributes.


NSTreeController expects every column of an NSOutlineView it is controlling to have the same attributes, and it expects every object at every level of the hierarchy it displays to use the same keys for both the children of a node and for whether a node is a leaf. That's just how NSTreeController is designed.

One way you can interoperate with this in your own code is to *not* bind directly to modeled attributes and relationships, but instead bind to keys that you define in categories in your own code. For example, let's say you're showing a filesystem hierarchy. You have two classes of item, File and Folder, where File instances are leaf nodes and Folder instances can have contents. You could add - isLeafForTreeController and -childrenForTreeController methods to each class, to return the appropriate values.

You may also be able to work with NSTreeNode objects directly -- which are used to represent the contents of an NSTreeController in 10.5 -- but unfortunately how to do so is still very sparsely documented. (It's not clear to me whether you can just set the content of a tree controller to a collection of NSTreeNode instances, for example.)

  -- Chris

_______________________________________________

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


  • Follow-Ups:
    • Re: NSTreeController / CoreData still broken in 10.5?
      • From: "Adam Gerson" <email@hidden>
References: 
 >NSTreeController / CoreData still broken in 10.5? (From: "Adam Gerson" <email@hidden>)

  • Prev by Date: Re: [ANN] RegexKitLite
  • Next by Date: Getting bounds of an NSTabViewItem tab
  • Previous by thread: Re: NSTreeController / CoreData still broken in 10.5?
  • Next by thread: Re: NSTreeController / CoreData still broken in 10.5?
  • Index(es):
    • Date
    • Thread