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)
But it doesn't work. Any help? (I need this to be dynamic, so I have to do it programmatically)
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)