On Fri, Dec 18, 2009 at 11:18 AM, Paul Bruneau <paul_brun...@special-lite.com> 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com