Reputation: 220
I need to make a custom NSDatePickerCell
to custom the highlight Color of this.
Also i read another question here: Hightlight color for NSDatepickerCell
And I override the method:
override func highlightColor(withFrame cellFrame: NSRect, in controlView: NSView) -> NSColor? {
return NSColor.green
}
This method never is called.
Another method is this:
override func highlight(_ flag: Bool, withFrame cellFrame: NSRect, in controlView: NSView) {
NSColor.green.set()
cellFrame.fill()
}
But if i set a color on this method for the cell frame, the program crash by :
CGContext invalid
Could someone help me?
Thanks
Upvotes: 0
Views: 153
Reputation: 431
I don't think this can be done by overriding NSDatePickerCell
. It doesn't use highlightColor
, it uses the system accent color which is set by the user in System Preferences.
Probably the only way to change the selection color is to subclass NSControl
and make your own picker.
Upvotes: 1