开发者

Automatically resizing subview created programmatically

I have a NSSplitView. On the left pane of that split view I have an NSTableView and a custom view created programmatically. I'm using a delegate to make sure my two panes don't resize at the same time.

I add my custom view thus:

BWAnchoredButtonBar *anchoredButtonBar = [[[BWAnchoredButtonBar alloc] initWithFrame:[leftPane bounds]] autorelease];
[leftPane addSubview:anchoredButtonBar];

And it seems to work ok. When I run my application everything works fine. Now, m开发者_运维问答y problem is that when I resize the split view pane, the custom view does not resize with it leaving an ugly white space between it and the divider of the NSSplitView.

I guess what I want to ask is, how can I programmatically set the springs and struts that IB sets visually?

Also, I can't use IB because Xcode 4 does not support IB plugins.


-[NSView setAutoresizingMask:] is how you set springs and struts programmatically.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜