开发者

setBackgroundColor covers element

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:

  1. In Interface Builder, move all your interface elements to a subclass of NSView that draws its background and add the view to your window.
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜