NSBackgroundStyleRaised Rx

May 12, 2010

I was having quite a bit of trouble getting NSBackgroundStyleRaised to work on my NSView subclass’s label, creating the NSTextField programmatically. I tried fiddling with the background color, I tried disabling my drawRect:. Really hard.

The strange thing was that it was working on labels I had created in Interface Builder but was setting the background style on programmatically. I didn’t find the answer until I looked closely at the settings that Interface Builder makes on labels. Here’s the solution:

[textField setDrawsBackground:NO];

And now I have a label that looks great on its superview’s gradient background.