I have an NSWindow, and I'm using this code to add a bottom-metal-bar at the开发者_Python百科 bottom.
[MyWindow setContentBorderThickness:40.0 forEdge:NSMinYEdge];
That works fine. But, once I use this:
[MyWindow setBackgroundColor: [NSColor redColor]];
The red covers the bar at the bottom. The bar shows correctly without the background color.
Yes, it would appear that changing the background-color of an NSWindow
negates its bottom border. In order to achieve both effects, you can do one of two things:
- In Interface Builder, move all your interface elements to a subclass of
NSView
that draws its background and add the view to your window. - Create an
NSView
that emulates the bottom border of your window and set the window's background color.
Personally, I would go for the first option, because it requires less work (trying to emulate a bottom border will be difficult, even with NSGradient
) , but both are a possibility.
精彩评论