Re: NSTreeController filter contents
Re: NSTreeController filter contents
- Subject: Re: NSTreeController filter contents
- From: Jens Alfke <email@hidden>
- Date: Tue, 24 Jun 2008 11:18:02 -0700
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@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