I have NSButtons
created in Storyboard that I would like to change the background color for. I have searched SO and Google but none of the solutions actually work on my project or even a simple test project. I've tried:
wantsLayer
). This must be a bug in macOS. I can make the NSButtonCell respond to backgroundColor simply by subclassing with an EMPTY class with one EMPTY override:
class ColorButtonCell: NSButtonCell {
override func draw(withFrame cellFrame: NSRect, in controlView: NSView) {
super.draw(withFrame: cellFrame, in: controlView)
}
}
When using this subclass, it all works as expected!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.