简体   繁体   中英

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, my 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:]是以编程方式设置弹簧和支柱的方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM