I have a NSButtonCell (a checkbox) in a cell-based NSTableView. I try to set its background color to a semi-transparent color (used tor the rest of the row), but this color fades to black. If the row color has an alpha of zero, the background of the control appears solid black.
Is there a way to mimic transparency on white instead of this (probably) nil color which default to black (0,0,0) ?
I think you should use buttons' layer
property instead since the gradual NSCell deprecation introduced several years ago already.
self.wantsLayer = true
self.layer.backgroundColor = UIColor.black.CGColor
It's much more easier than messing with a drawRect(:)
-method.
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.