NSView 设置背景色
程序员文章站
2022-07-13 13:01:43
...
iOS中UIView设置背景色是
UIView *view= [[UIView alloc]init];
view.backgroundColor = [UIcolor redcolor];
OS X中NSView没有backgroundColor这个属性,所以无法直接设置
CALayer *viewLayer = [CALayer layer];
NSView *backgroundView= [[NSView alloc]init];
[backgroundView setWantsLayer:YES];
[backgroundView setLayer:viewLayer];
backgroundView.layer.backgroundColor = [NSColor colorWithRed:0.14 green:0.62 blue:0.93 alpha:1.0].CGColor;
[backgroundView setNeedsDisplay:YES];
上一篇: css:背景色设置
下一篇: POI生成excel