• 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: Chris Pavicich <email@hidden>
  • Date: Thu, 13 May 2004 20:07:28 -0400

Hi Scott:

Thanks for the response. I was necessarily trying to bypass the accessor.
I just expected '_attributes' and 'attributes' to behave the same I guess.

Thanks again for clearing that up.

--CMP

On May 13, 2004, at 19:03, Scott Anguish wrote:



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.


References: 
 >KVO Oddity (From: Chris Pavicich <email@hidden>)
 >Re: KVO Oddity (From: Scott Anguish <email@hidden>)

  • Prev by Date: Re: Cocoa Programming for Mac OS X (SE)
  • Next by Date: Re: window rotation
  • Previous by thread: Re: KVO Oddity
  • Next by thread: Re: KVO Oddity
  • Index(es):
    • Date
    • Thread