I have a NSTextField bound to my model. If I change the content of the text field programmatically, the model isn't updated. I know that you're supposed to update the model instead.
But I'm trying to implement an NSTextField subclass that recognizes a scroll while the mouse is hovering over it to change it's numerical value. Obviously I don't have access to the model from this subclass. So you have any suggestions how I could do this?
SOLUTION (thanks to noa):
- (void)scrollWheel:(NSEvent *)theEvent {
[self setFloatValue:[self floatValue] - [theEvent deltaY]];
NSDictionary *bindingInfo = [self infoForBinding: NSValueBinding];
NSObject *boundObject = [bindingInfo valueForKey:NSObservedObjectKey];
NSString *keyPath = [bindingInfo valueForKey:NSObservedKeyPathKey];
[boundObject setValue:[NSNumber numberWithFloat:[self floatValue]]
forKeyPath:keyPath];
}