0
我试图用颜色填充我的NSView
,但它没有使用我想要的颜色。它只是黑色。使用变量设置默认的NSView填充颜色
这是我的NSView的一个子类实现:
#import "OCOvalView.h"
@implementation OCOvalView
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
bgColorValue = [NSColor greenColor];//I WANT IT TO BE FILLED GREEN
}
return self;
}
- (void)drawRect:(NSRect)dirtyRect
{
[bgColorValue set];
[NSBezierPath fillRect:[self bounds]];//BUT IT ENDS UP BLACK!!
}
@end
如果我改变[bgColorValue set];
到[[NSColor greenColor] set];
它的工作,但我想用一个变量,如上图所示。
如何获取与bgColorData
颜色相同的颜色?