I found a solution without using auto layout constraints. I'm working with Rubymotion so my solution is in Ruby but it can be easily translated in Objective-C.
First of all, to get only left and right subviews changing their size when the user drags the divider between the left and the middle subviews, I created two nested NSSplitView
, the second one into the right part of the first one.
The last point mentionned in the question, that is to say when the user drags the divider between the middle and the right subviews only these subviews change size
is the default behavior of an NSSplitView
so nothing to do here.
Finally, to get only rightmost subview changing its size when the user resizes the window, I implemented the splitView:resizeSubviewsWithOldSize:
delegate method:
def splitView(splitView, resizeSubviewsWithOldSize:oldSize)
sv1 = splitView.subviews[0]
sv2 = splitView.subviews[1]
leftFrame = sv1.frame
rightFrame = sv2.frame
newFrame = splitView.frame
leftFrame.size.height = newFrame.size.height
rightFrame.size.height = newFrame.size.height
leftFrame.origin = NSMakePoint(0,0)
## 1 is the NSSplitView divider width
rightFrame.size.width = newFrame.size.width - leftFrame.size.width - 1
rightFrame.origin.x = leftFrame.size.width + 1
sv1.setFrame(leftFrame)
sv2.setFrame(rightFrame)
end
And voilà! It took me a while to make it work so I hope it will save a few time to other people.