I created a split view controller that displays two views, like this :
When I compile it, it gives me this result :
Unfortunately, the first view isn't visible and I must drag from the left hand side of the window to see the two views :
First, why is the split view behaving like this ? Why isn't it already at the right size from the beginning ?
If I add this line to the viewDidLoad() function of my SplitViewController :
splitView.adjustSubviews()
Then the two view appears, with equal size, but I don't understand what the adjustSubviews() function does exactly, and I can't control the position of either.
How to fix it programmatically ? How to adjust the size of each view ? Is there a way to adjust it in interface builder ?
Thank you.
EDIT : There is now a bounty of 50 points for this question
Since NSSplitViewController is auto-layout based, you can use auto-layout either if you want a fixed or a dynamic behavior on your views.
For a fixed width what you can do is add a custom view inside your 2 views with a 0 constraint to all the edges and a fixed width. For example:
Then the window will get expanded as follows:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With