Is KVO disabled during observeValueForKeyPath?
Is KVO disabled during observeValueForKeyPath?
- Subject: Is KVO disabled during observeValueForKeyPath?
- From: Larry Gerndt <email@hidden>
- Date: Sun, 9 Apr 2006 11:14:36 -0700
I've discovered what I believe is a bindings caveat: If you have a
view object bound to a property in your model, and you're observing
new values for that property via observeValueForKeyPath, and, when
the controller calls that method, you (for some reason) try to change
the new value to some other value, your view will not update to the
new value. I suspect this is because while the controller is calling
your observeValueForKeyPath it will not notice any changes you make
to that property.
I found an excellent solution to this: instead of changing the value
from within observeValueForKeyPath, I instead implement
validateValueForKeyPath and change the value there and return YES.
This is how I should have implemented it in the first place, and it
works well, but I'm just curious as to whether the above caveat is
indeed a known behavior.
-
Larry Gerndt
Web sites: Emerging Truths CoreData
AIM: SonOfTheSonOfMan
"Let the truth be told though the heavens fall" -- James
Garrison
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden