Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 247
ruipacheco Avatar asked Apr 18 '11 23:04

ruipacheco


1 Answers

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

like image 181
Dave DeLong Avatar answered Sep 28 '22 09:09

Dave DeLong