6/27/08 1:37 PM, also sprach [EMAIL PROTECTED]:

> I've got two classes - let's call them "Foo" and "Bar". Foo's
> implementation has this in it:
> 
> - (void)setDisplayName:(NSString *)name {
>      [self willChangeValueForKey:@"displayName"];
> 
>      NSLog(@"setting display name to %@", name);
> 
>      if(name != ivar_displayName) {
>          [ivar_displayName release];
>          ivar_displayName = [name copy];
>      }
> 
>      [self didChangeValueForKey:@"displayName"];
> }
> 
> whereas Bar's implementation has this:
> 
> - (void)setTitle:(NSString *)title {
>      [self willChangeValueForKey:@"title"];
> 
>      NSLog(@"setting title to %@", title);
> 
>      if(title != ivar_title) {
>          [ivar_title release];
>          ivar_title = [title copy];
>      }
> 
>      [self didChangeValueForKey:@"title"];
> }

If you aren't overriding +automaticallyNotifiesObserversForKey: to return
NO, you should not be calling  willChangeValueForKey/didChangeValueForKey in
your setters. They are KVC-compliant as shown. Fix that, then see if the
problem goes away.

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to