
如图中所示,当我们设置
NSTextField
的父视图的背景色的时候,其本身也会生成一个背景色。
我尝试过以下方法:
self.label.wantsLayer = YES;
self.label.layer.backgroundColor = [NSColor clearColor].CGColor;
无效
正确的处理方式:

1、勾选
Draws Background
2、设置Background
为透明色
NSTextField
的父视图的背景色的时候,其本身也会生成一个背景色。
self.label.wantsLayer = YES;
self.label.layer.backgroundColor = [NSColor clearColor].CGColor;
无效
1、勾选
Draws Background
2、设置Background
为透明色
本文标题:Mac 开发 NSTextField背景色如何去掉
本文链接:https://www.haomeiwen.com/subject/ldagjktx.html
网友评论