• 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: Dependent values that are not iVars
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dependent values that are not iVars


  • Subject: Re: Dependent values that are not iVars
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 18 Dec 2009 11:28:44 -0800

On Fri, Dec 18, 2009 at 11:18 AM, Paul Bruneau
<email@hidden> wrote:
>>           if ([keyPath isEqualToString:kOverallWidth]) {
>>                        [self willChangeValueForKey:@"overallWidth"];
>>                        NSLog(@"got notification that overallwidth changed:
>> %@", object);
>>                        [self didChangeValueForKey:@"overallWidth"];
>>           }

Please note that it is not correct to call -will/didChangeValueForKey:
without actually changing the value. The KVO mechanism might just
simply not send a notification at all. (Well, I guess it's valid, but
you might see fewer observation notifications than you would expect.)
This is difficult to get right with derived properties.

Also don't have the first inclination I had, which is to use
-keyPathsForValuesAffectingValueForKey:. As described in the
documentation, it will not work.

--Kyle Sluder
_______________________________________________

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

  • Follow-Ups:
    • Re: Dependent values that are not iVars
      • From: Quincey Morris <email@hidden>
    • Re: Dependent values that are not iVars
      • From: Paul Bruneau <email@hidden>
References: 
 >Dependent values that are not iVars (From: Paul Bruneau <email@hidden>)
 >Re: Dependent values that are not iVars (From: Quincey Morris <email@hidden>)
 >Re: Dependent values that are not iVars (From: Paul Bruneau <email@hidden>)

  • Prev by Date: Re: Dependent values that are not iVars
  • Next by Date: Re: Picking and Selection
  • Previous by thread: Re: Dependent values that are not iVars
  • Next by thread: Re: Dependent values that are not iVars
  • Index(es):
    • Date
    • Thread