Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why aren't my bindings firing?



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Why aren't my bindings firing? (From: Charles Srstka <email@hidden>)
 >Re: Why aren't my bindings firing? (From: Ken Thomases <email@hidden>)
 >Re: Why aren't my bindings firing? (From: Charles Srstka <email@hidden>)
 >Re: Why aren't my bindings firing? (From: Ken Thomases <email@hidden>)
 >Re: Why aren't my bindings firing? (From: Charles Srstka <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.