Skip navigation.
 
mlRe: NSTreeController filter contents
FROM : Jens Alfke
DATE : Tue Jun 24 20:18:02 2008

On 24 Jun '08, at 10:33 AM, Michael Hanna wrote:

> So how does your tree controller know how to return FilteredItem
> instead of Item?


The NSTreeController doesn't create any objects. It's entirely up to 
your model objects what children they return.

In what I'm doing, the tree controller never sees an Item directly, 
only FilteredItems, because -[FilteredItem children] returns an 
NSArray of FilteredItems. (It asks its Item for its children, then 
wraps each one in a new FilteredItem and returns an array of those.)

> I thought you have to return the model class for the object 
> controller that you set in the nib file.


No, it doesn't matter what class they are as long as they respond 
properly to the children/isLeaf/count selectors you specify. (It's 
"duck typing", as the Ruby people say.)

—Jens_______________________________________________

Cocoa-dev mailing list (<email_removed>)

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:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mlNSTreeController filter contents Michael Hanna Jun 24, 02:10
mlRe: NSTreeController filter contents Jens Alfke Jun 24, 03:09
mlRe: NSTreeController filter contents Michael Hanna Jun 24, 19:33
mlRe: NSTreeController filter contents Jens Alfke Jun 24, 20:18