• 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: Setting the selection of an array controller?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting the selection of an array controller?


  • Subject: Re: Setting the selection of an array controller?
  • From: Quincey Morris <email@hidden>
  • Date: Fri, 25 Mar 2011 18:22:58 -0700

On Mar 25, 2011, at 18:01, Rick Mann wrote:

> Part of the problem I had was that I don't have indices readily available. I have the objects themselves, and I could look them up in the array, but that strikes me as potentially slow (for a lot of objects).

There's always -[NSArrayController setSelectedObjects], though using that might just drive the work involved in deriving selection indexes inside NSArrayController, where you can't even control the performance.

But the point is that the underlying mechanism is all in NSArrayController's documented API, and you should be reading that.

> I think there's a typo there, so I'm not quite sure what you're telling me. In fact, I will eventually have both a custom control in the inspector, and the view in which the selection is managed by the user is custom.

Yes, it was a typo. I meant:

> "you aren't going to want to do this with bindings, not when the selection is controlled from a custom view"

For a custom view, that is, where the behavior of the view is enshrined in code you write, there's absolutely no value in using bindings, and creating a bindings mechanism for that view is wasted work.

Bindings are for UI elements (and similar stuff) that are reused in many contexts, so that they can be configurable in IB without additional coding. Your custom view is being used in one context (presumably, more or less), and you're coding its behavior anyway.

Putting this another way, bindings are (in use) a kind of code-free extension of the KVO mechanism (addObserver... and observeValue...). If you're coding anyway, it's cheaper and easier to use KVO directly.

That was the point I was trying to make.


_______________________________________________

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: Setting the selection of an array controller?
      • From: Rick Mann <email@hidden>
References: 
 >Setting the selection of an array controller? (From: Rick Mann <email@hidden>)
 >Re: Setting the selection of an array controller? (From: Quincey Morris <email@hidden>)
 >Re: Setting the selection of an array controller? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Setting the selection of an array controller?
  • Next by Date: Re: Hash Values in Custom Classes
  • Previous by thread: Re: Setting the selection of an array controller?
  • Next by thread: Re: Setting the selection of an array controller?
  • Index(es):
    • Date
    • Thread