When an NSButton
's value
and hidden
state are bound to properties, changing either property enables the button.
See example code:
@interface MyClass ()
@property (nonatomic) BOOL buttonHidden;
@property (nonatomic) BOOL buttonState;
@end
@implementation MyClass {
__weak IBOutlet NSButton *button; // The button is in a view designed in IB
}
- (void)awakeFromNib {
[super awakeFromNib];
[button bind:NSHiddenBinding toObject:self withKeyPath:@"buttonHidden" options:nil];
[button bind:NSValueBinding toObject:self withKeyPath:@"buttonState" options:nil];
button.enabled = NO;
self.buttonHidden = NO; // This enables the button. If this line isn't executed, the buttons stays disabled.
}
@end
Note that the issue occurs only of both properties are bound.
I wonder if this is by design or a bug.