开发者

Setting Horizontal Line (NSBox) line width in Interface Builder

I have an application that I am building am making use of Horizontal Line (which is just a special case of NSBox). I've placed the component into the interface, but what to adjust the thickness of the line.

NSBox has a setBorderWidth method, but doesn't seem to have this exposed when in Interface Builder. I would prefer not to do this manually, as I don't want to have to maintain an object simply to adjust this single value.

Is there a way to set this via Interface Builder that I am just missing?

Or, failing that, is there a better way to put a Horizontal Line in your UI such that you can control it's attributes via Int开发者_如何学JAVAerface Builder?


On the Attributes pane of the inspector, set the Border Type to Custom. Then on the Size pane, set the border width as needed.


The best way is to instead add a Custom Box control (which is an NSBox), set its box type to Custom and its border type to Line.

Then set the control's height to 1 in the normal way, as well as its tint and whatever else you need.

The Horizontal Line control is really just a shortcut to get a NSBox that's been hard-coded to use the default separator line style; it doesn't allow you to configure much else. But, despite the name, it's neither the only nor arguably the best way to make a horizontal line.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜