Re: Bindings and KVO of View objects
Re: Bindings and KVO of View objects
- Subject: Re: Bindings and KVO of View objects
- From: Stuart Malin <email@hidden>
- Date: Tue, 19 May 2009 14:22:40 -1000
On May 19, 2009, at 1:44 PM, Quincey Morris wrote:
On May 19, 2009, at 14:18, Stuart Malin wrote:
<snip>
My specific concern is with NSSegmentedControl, which has a bindable
property "selectedIndex". I am trying to add an observer for this
property (using -addObserver: on an instance). Alas, I am not
getting an observer event (i.e, invocation of my -
observerForKeyPath:... method) when I change the segmented control
in the U/I. So, either I have done something incorrectly in setting
up the observer, or this is not an observable property.
<snip>
Finally, it usually indicates a design flaw if you're trying to
observe a property of a user interface object. It's almost always
better to observe the value that the UI object is bound to. (There are
valid exceptions, though.)
I don't see why it is a design flaw to want to bind to the
selectedIndex of a segmented control so that when the user changes the
selected segment, my code to take action. Binding to the control is
conceptually quite similar. The two approaches to me seem to be
matters of implementation specifics.
_______________________________________________
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