Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSSplitView make only one panel expand on window resize using auto-layout?

Is it possible to achieve the following just using the auto-layout options available from Xcode? For example by changing hugging or compression settings.

Expanding only one panel of an NSSplitView using auto-layout

What is the recommended way of achieving this resize behaviour?

like image 329
Daniel Farrell Avatar asked Jul 15 '13 06:07

Daniel Farrell


1 Answers

If you want to achieve a fixed left panel, just select the left view in Interface Builder an choose "Editor" → "Pin" → "Width". This will make the divider unmovable, though.

If you want to keep a draggable divider, you can use the "Holding Priorities" slider in IB. To prioritize growth of the right panel, select the split view in IB and lower the "Right" holding priority to 1.
Note that those priorities have been added in Mountain Lion. Details can be found in the 10.8 AppKit release notes.

If you need to support 10.7, achieving this NSSplitView behavior might be way harder. Apple fixed several bugs and shortcomings with 10.8 (especially in conjunction with split views).

like image 94
Thomas Zoechling Avatar answered Sep 23 '22 09:09

Thomas Zoechling