• 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: Why aren't my bindings firing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Why aren't my bindings firing?
      • From: Charles Srstka <email@hidden>
References: 
 >Why aren't my bindings firing? (From: Charles Srstka <email@hidden>)

  • Prev by Date: How to deal with a MenuItem with both a binded state property and an action method
  • Next by Date: Re: How to deal with a MenuItem with both a binded state property and an action method
  • Previous by thread: Why aren't my bindings firing?
  • Next by thread: Re: Why aren't my bindings firing?
  • Index(es):
    • Date
    • Thread