Re: Why aren't my bindings firing?
Re: Why aren't my bindings firing?
- Subject: Re: Why aren't my bindings firing?
- From: Keary Suska <email@hidden>
- Date: Fri, 27 Jun 2008 16:17:47 -0600
- Thread-topic: Why aren't my bindings firing?
6/27/08 1:37 PM, also sprach email@hidden:
> 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 (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