Re: How to know whether property in Cocoa class is KVO-compliant?
Re: How to know whether property in Cocoa class is KVO-compliant?
- Subject: Re: How to know whether property in Cocoa class is KVO-compliant?
- From: Quincey Morris <email@hidden>
- Date: Mon, 11 Jan 2010 03:47:05 -0800
On Jan 10, 2010, at 19:58, Jerry Krinock wrote:
> After studying some about bindings during the last week, I decided that, just for fun, I would bind an NSSegmentedControl to its window controller using a binding instead of target/action. I thought that selectedSegment might be a KVO-compliant property of NSSegmentedControl because it has a -selectedSegment and -setSelectedSegment: method.
>
> So I exposed a binding named @"foo" in my window controller's +initialize, in -awakeFromNib I added this:
>
> [windowController bind:@"foo"
> toObject:segmentedControl
> withKeyPath:@"selectedSegment"
> options:0] ;
Adding on to mmalc's response, to make this explicit:
You *didn't* "bind an NSSegmentedControl to its window controller", you actually bound a window controller['s "foo" binding] to [the "selectedSegment" property of] a NSSegmentedControl.
IIRC the bindings documentation isn't clear which direction "is bound to" refers to and/or it gives the impression that a binding is symmetric (which it may effectively be at the level of notifications, but it isn't at the level of establishing bindings between objects).
_______________________________________________
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