I'm trying to understand how splitview works.
I have this simple split view layout.
and the button action methods:
@IBAction func hideYellow(sender: NSButton){
splitV.arrangedSubviews[0].isHidden = !splitV.arrangedSubviews[0].isHidden
splitV.adjustSubviews()
}
@IBAction func hideGreen(sender: NSButton){
splitV.arrangedSubviews[1].isHidden = !splitV.arrangedSubviews[1].isHidden
splitV.adjustSubviews()
}
It works when the buttons are clicked, but the during this process the size of subviews are changed.
Here are the screnshots of hiding/unhiding yellow view for 4 times.
1st time:
As you noticed, the yellow view size is changed.
2nd time:
3rd time:
4th time:
So more time you repeat this, theyellow view gets smaller and smaller.
The splitview in xib:
I tried giving width constraint to white view, to stop yellow view from getting smaller during this process. Still it didnt respect the wdith constraint of white view.
I also unchecked the autoresize subviews option for yellow view.
Please let me know what mistake I did.