• 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 filter contents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSTreeController filter contents (From: "Michael Hanna" <email@hidden>)
 >Re: NSTreeController filter contents (From: Jens Alfke <email@hidden>)
 >Re: NSTreeController filter contents (From: "Michael Hanna" <email@hidden>)

  • Prev by Date: Re: NSTreeController filter contents
  • Next by Date: wrapping multiple IBOutlet objects for reuse
  • Previous by thread: Re: NSTreeController filter contents
  • Next by thread: CoteData pagination
  • Index(es):
    • Date
    • Thread