Re: Why aren't my bindings firing?
Re: Why aren't my bindings firing?
- Subject: Re: Why aren't my bindings firing?
- From: Ken Thomases <email@hidden>
- Date: Sat, 28 Jun 2008 01:57:33 -0500
On Jun 28, 2008, at 1:30 AM, Charles Srstka wrote:
I guess the only question I still have then is: why did my example
worke one-way in the first place? If the bindings are in a different
namespace, shouldn't it have failed for lack of an exposed binding
named "title" in the Bar object? Or is there a *little* magic going
on here, just not going all the way?
That depends on how the bar class from your OP (or one of its
superclasses) implemented bind:toObject:withKeyPath:options:. That
code may not have checked the passed-in binding name, and may have
unconditionally added itself as an observer of ivar_controller for the
key path "selection.displayName". That would have guaranteed that bar
would receive observeValueForKeyPath:ofObject:change:context: messages
whenever foo's displayName property was changed in a KVO-conforming
manner. (For example, if, in listing 2 of the how-it-works document,
the check of the binding name against "angle" were omitted.)
Then, what happens next is up to bar's implementation of
observeValueForKeyPath:ofObject:change:context:. If it blindly did
[self setTitle:[object valueForKeyPath:keyPath]], then that would
explain it. (For example, if, in listing 4, the test of context were
omitted.)
Regards,
ken
_______________________________________________
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