How to disable resizing of the subview of NSSplitView in Interface Builder?

dzolanta picture dzolanta · Jan 10, 2010 · Viewed 7.9k times · Source

I've created in Interface Builder a NSSplitView with two subviews. I want the left-side view to have fixed width. I've tried to define autosizing rules for both subviews but the left subview still changes width on window resizing (split view fills up a window). May be that caused by NSSplitView's Autoresizes Subviews property? (I can't uncheck it). What can I do?

Answer

Chris Livdahl picture Chris Livdahl · May 23, 2013

The best way I found to do this in Interface Builder:

  • Drop the NSSplitView on the window
  • Select the Custom View you want fixed
  • Go up to the Xcode menu and select Editor > Pin > Width
  • Adjust the Constant in the Attributes Inspector to the size that you want the panel to be fixed at

Of course, you can also add this layout constraint through code as suggested above if you're feeling adventurous.