• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why do I receive KVO notification when new value IS the old value?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Why do I receive KVO notification when new value IS the old value? (From: Jerry Krinock <email@hidden>)
 >Re: Why do I receive KVO notification when new value IS the old value? (From: Kiel Gillard <email@hidden>)

  • Prev by Date: Re: Help
  • Next by Date: Re: Why do I receive KVO notification when new value IS the old value?
  • Previous by thread: Re: Why do I receive KVO notification when new value IS the old value?
  • Next by thread: Re: Why do I receive KVO notification when new value IS the old value?
  • Index(es):
    • Date
    • Thread