Mac 开发 NSTextField背景色如何去掉
2020-08-24 本文已影响0人
本帅不良

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

1、勾选
Draws Background
2、设置Background
为透明色