• 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: change in model not reflected in interface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: change in model not reflected in interface


  • Subject: Re: change in model not reflected in interface
  • From: Edward Hillenbrand <email@hidden>
  • Date: Sat, 30 Jul 2005 11:17:11 -0700

On Jul 29, 2005, at 5:25 PM, mmalcolm crawford wrote:


You should change attributes in a key-value observing compliant manner. Typically this simply means using accessor methods that follow standard naming conventions


Here is a simplified version of what I'm trying to do:

@interface Model : NSObject {
    float foo;
    float bar;
}
- (float)foo;
- (void)setFoo:(float)value;

- (float)bar;
- (void)setBar:(float)value;
@end

@implementation Model
- (float)foo { return foo; }
- (void)setFoo:(float)value { foo = value; }

- (float)bar { return bar; }
- (void)setBar:(float)value { bar = value; }

- (void)didChangeValueForKey:(NSString *)key {
if ( [key isEqualToString:@"foo"] ) {
[self setBar:[self foo] * 2]; // this change is not reflected in the interface???
NSLog(@"%f", [self bar]);
}
}
@end


AFAIK, the object above is KVO complaint. I have an interface with two text fields, one bound to foo and the other bound to bar. When I change the value in the text field bound to foo the value in the text field bound to bar doesn't change.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: change in model not reflected in interface
      • From: mmalcolm crawford <email@hidden>
References: 
 >change in model not reflected in interface (From: Edward Hillenbrand <email@hidden>)
 >Re: change in model not reflected in interface (From: Scott Quiring <email@hidden>)
 >Re: change in model not reflected in interface (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: NSTextField
  • Next by Date: Re: Failed to copy Resource Fork??
  • Previous by thread: Re: change in model not reflected in interface
  • Next by thread: Re: change in model not reflected in interface
  • Index(es):
    • Date
    • Thread