NSView,NSTextFieldCell设置背景颜色
2019-04-16 本文已影响0人
拥抱月亮的大星星
1. NSVIew设置背景色
注意wantsLayer需要先写才生效
self.bgView.wantsLayer = YES;
self.bgView.layer.backgroundColor = [NSColor redColor].CGColor;
2. NSTextFieldCell设置背景色
setDrawsBackground:YES
self.openResultLabel.backgroundColor = [NSColor whiteColor];
[self.openResultLabel setDrawsBackground:YES];