How should I use auto layout constrains inside NSSplitView
subview?
My NSSplitView
subview has 3 subview: topPane
, tableCont
I found out that this error appears if I have toolbar in my window and control split view by any of this delegate methods:
splitView:constrainMinCoordinate:ofSubviewAt:
splitView:constrainMaxCoordinate:ofSubviewAt:
splitView:shouldAdjustSizeOfSubview:
Solution was found in attaching toolbar to window in windowDidLoad.
For anyone who stumbles onto this in the future and is looking for a jump-start into constraint-based NSSplitView
replacements, I wrote a small project here that attempts to recreate a portion of NSSplitView
's features using Auto Layout:
https://github.com/jwilling/JWSplitView
It's somewhat buggy, but it could be a useful reference to anyone wanting to go this route.
As much as I hate to disagree, but Auco's answer should't be voted highest. It is not in any way helpful in solving the problem with an adequate amount of work. In my opinion the NSSplitView was only ever a problem to those who didn't read the documentation well enough.
The actual solution to the problem mentioned here is fairly simple: Auto Layout introduced the new "Holding Priorities API" on NSSplitView. And as the documentation says: Setting lower values to the holding priority of a subview will make him more likely to take width earlier. All of this can be set in IB and programmatically without any despair. The amount of work needed: 20 seconds approx.