I am working on a Menubar app, which have a custom BackGroundView inherited from NSView, which is declared as a property named "backgroundView" in the PanelController class. I need to set violet color to this backgroundView. Can anybody tell me how do i accomplish this. Thanks in advance...
Asked
Active
Viewed 255 times
0
-
You tagged your question with iOS. Aren't menubar apps & NSView OS X specific? – Thomas Zoechling Apr 28 '13 at 13:22
-
yes they are... I'm removing the tag; also [this same question has been asked and answered before](http://stackoverflow.com/questions/2962790/best-way-to-change-the-background-color-for-an-nsview) – Michael Dautermann Apr 28 '13 at 13:24
-
@MichaelDautermann : Sorry, thanks for the edit – nbs Apr 28 '13 at 13:36
1 Answers
0
In your drawRect:
method you would have something like:
-(void)drawRect:(NSRect)rect
{
[[NSColor colorWithCalibratedRed:1 green:0 blue:1 alpha:1] set]; //Not sure if this is violet, just change the color yourself
[NSBezierPath fillRect:rect];
}

TheAmateurProgrammer
- 9,252
- 8
- 52
- 71
-
But, when i use this, the color even fills the space between menubar and the View. I want only the background view to have the colour. – nbs Apr 28 '13 at 14:52