SMS
SMS

Reputation: 558

How to set the background color of Customview(NSView)in mac applications?

I have tried to change the background color of NSView like this in iOS,

self.titleview.backgroundcolor = [UIColor redColor];

But no property like that exists so after it, I tried,

self.titleBarView.layer.backgroundColor = [[NSColor redColor]set];

But it shows some error.

Upvotes: 0

Views: 767

Answers (1)

Yogendra
Yogendra

Reputation: 1716

  self.titleBarView.layer.backgroundColor = [NSColor redColor].CGColor;

If you do not want to use view.layer. You can use NSBox (with custom style) over NSView. NSBox has fillColor property.

Upvotes: 2

Related Questions