• 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: KVO Oddity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVO Oddity


  • Subject: Re: KVO Oddity
  • From: Scott Anguish <email@hidden>
  • Date: Thu, 13 May 2004 19:03:00 -0400

On May 13, 2004, at 4:46 PM, Chris Pavicich wrote:

Hi List:

I am working on a simple application using KeyValueObserving. And have run into some interesting behaviour
using setKeys:triggerChangeNotificationsForDependentKey: The class I am working with is below.

If I call setKeys:... using @"_attributes" and _attributes is changed a change notification is never sent.
If I call setKeys:... using @"attributes" and _attributes is changes, the notification IS sent.

Perhaps, I don't quite get what's going on, but shouldn't '_attributes' and 'attributes' be interchangeable in this
case?


_ as the first character of a variable is reserved.

KVC will look for _ in the variable name if you asked for attributes, but didn't implement -attributes,

So, the moral is, don't use _ and don't try and bypass your accessors using KVC.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: KVO Oddity
      • From: Joakim Danielson <email@hidden>
    • Re: KVO Oddity
      • From: Chris Pavicich <email@hidden>
References: 
 >KVO Oddity (From: Chris Pavicich <email@hidden>)

  • Prev by Date: Re: CPU Speed ...
  • Next by Date: Re: window rotation
  • Previous by thread: KVO Oddity
  • Next by thread: Re: KVO Oddity
  • Index(es):
    • Date
    • Thread