Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

andrew086

macrumors regular
Original poster
Dec 31, 2009
242
0
I was able to bind an NSStepper and NSTextField to the same object by first, binding the Content Object of my NSObjectController to MyModel, then binding the NSStepper and NSTextField values to selection.myFloat (where myFloat is a KVC ivar in MyModel). I'm now trying to do this programmatically replicate this, but it isn't exactly working.

Here's what I'm trying:
(in my NSObjectController subclass)
Code:
[self bind:@"contentObject" toObject:_model withKeyPath:@"self" options:nil]; // _model is an instance of MyModel
[_stepper bind:@"value" toObject:self withKeyPath:@"selection.myFloat" options:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSContinuouslyUpdatesValueBindingOption]];
[_textField bind:@"value" toObject:self withKeyPath:@"selection.myFloat" options:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSContinuouslyUpdatesValueBindingOption]];

But it doesn't work. Any help? (I need this to be dynamic, so I have to do it programmatically)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.