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 (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to