Re: Why do I receive KVO notification when new value IS the old value?
Re: Why do I receive KVO notification when new value IS the old value?
- Subject: Re: Why do I receive KVO notification when new value IS the old value?
- From: Graham Cox <email@hidden>
- Date: Thu, 9 Jul 2009 10:02:38 +1000
On 09/07/2009, at 9:49 AM, Kiel Gillard wrote:
To prevent this behaviour, you could override setName: to only
change the value when the pointers are not the same.
That doesn't change the automatic KVO notification behaviour, which
takes effect 'outside' of the method itself. Whatever the method does
internally, the 'will change' goes out before it runs and the 'did
change' after.
You can prevent the KVO notification if you suppress the automatic
notification for that property (override
+automaticallyNotifiesObserversForKey: to return NO for that key) and
add the will change/did change calls manually to your code only when
the value has changed.
--Graham
_______________________________________________
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