Re: KVO dependent keys
Andy Lee <[email protected]> Wed, 15 Jun 2011 09:23:53 -0400
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Jun 15, 2011, at 9:04 AM, Christiaan Hofman wrote: > Small correction, of course I meant +keyPathsForValuesAffectingValueForKey: and keyPathsForValuesAffecting<Key>. That does not change the question. I have used both approaches and switched between them, probably for the same reason. As far as I know it works as advertised, and you're reading the "advertisement" correctly. I recently was scratching my head over a similar problem where the Affecting<Key> method did not seem to work. I vaguely remember the reason was something like using the wrong name for a boolean property. I either had to include or exclude the "is" prefix, I forget which; in the end I think I may have renamed the property without the "is". But if you're using the same <Key> in both approaches I can't imagine offhand why it wouldn't work. Is it possible you have a stale version of +keyPathsForValuesAffectingValueForKey: that you neglected to delete? Or, if you're combining the approaches, are you calling super in +keyPathsForValuesAffectingValueForKey:, so that it can use the default implementation, which looks for the +keyPathsForValuesAffecting<Key> method? Maybe post both versions of your +keyPathsFor... methods as a sanity check? --Andy