For some reason, when my button is disabled, the text color turns white. I want it to stay black - how can i do that?
For some reason, when my button is disabled, the text color turns white. I want it to stay black - how can i do that?
In Mojave, any override of draw methods makes it impossible to change the backgroundColor of the NSbutton when highlighted. So I would rather recommend to use
- (BOOL)_shouldDrawTextWithDisabledAppearance
for this purpose. If you are using Swift 4, I would do the following in the Bridging header:
#import <AppKit/AppKit.h>
@interface NSButtonCell (Private)
- (BOOL)_shouldDrawTextWithDisabledAppearance;
@end
And in the subclass of NSButtonCell:
override func _shouldDrawTextWithDisabledAppearance() -> Bool {
return false
}