Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I implement a 3 pane NSSplitView with minimum & maximum sizes?

I want to implement a 3-pane vertical NSSplitView (very similar to Mail.app). I'm not really sure where to start. I'm pretty sure I need to implement a NSSplitViewDelegate, but I'm not sure which methods and / or their implementations.

The layout I want is the following:

+----------+------------------+------------------------------------+
|          |                  |                                    |
|          |                  |                                    |
|          |                  |                                    |
|          |                  |                                    |
|  Pane 1  |      Pane 2      |               Pane 3               |
|          |                  |                                    |
|          |                  |                                    |
|          |                  |                                    |
|          |                  |                                    |
|          |                  |                                    |
+----------+------------------+------------------------------------+

I want to implement the following constraints for each of the panes:

  • Pane 1: Minimum 140pt. Maximum: 400pt.
  • Pane 2: Minimum 250pt.
  • Pane 3: Minimum 400pt.

Any pointers would be much appreciated.

like image 983
Olly Avatar asked Jul 30 '12 23:07

Olly


2 Answers

To enforce a minimum size, check out the BESplitViewConstraintEnforcer utility class we created.

By the way: if you want to avoid nesting split views and instead add an additional pane in Interface Builder, drag the new view into the split view object, as shown in the screenshot below.

Screenshot

like image 66
Philipp Avatar answered Nov 14 '22 02:11

Philipp


It is pretty simply in Xcode 8.2.1

  1. Just add a Split View Controller in Interface Builder.
  2. Add an additional View Controller.
  3. Crtl + mouse press on the Split View Controller and drag to the additional View Controller.
  4. Select split items.

That's it.

like image 26
asdf Avatar answered Nov 14 '22 00:11

asdf