自定义NSButtonCell黑色背景

时间:2016-10-05 13:03:00

标签: cocoa colors background nsbuttoncell

我在基于单元格的NSTableView中有一个NSButtonCell(一个复选框)。我尝试将其背景颜色设置为半透明颜色(用于行的其余部分),但此颜色渐渐变为黑色。如果行颜色的alpha为零,则控件的背景显示为纯黑色。

有没有办法模仿白色的透明度而不是这个(可能)nil颜色,默认为黑色(0,0,0)?

1 个答案:

答案 0 :(得分:0)

我认为你应该使用按钮' self.wantsLayer = true self.layer.backgroundColor = UIColor.black.CGColor 属性,因为几年前已经引入了gradual NSCell deprecation

drawRect(:)

比使用Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(it.sauronsoftware.ftp4j.FTPClient$2) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(it.sauronsoftware.ftp4j.FTPClient$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. 方法更容易。