Problems with initial sizes of NSSplitView (storyboards and fast)

I just started a simple Cocoa application using Swift, Storyboards and Document.

The only change I made is to replace the standard view controller in Main.storyboard with the Split View controller. Everything works fine, since the sub-items are filled out correctly, with the exception of one thing: the divider is always in the very left corner of the window when I launch the application. This is a vertical split view. (If I go to the horizontal, the divider starts at the very top.)

I tried adding restrictions, but IB won't even let me add restrictions to anything other than the content in subviews.

I also tried using splitView.setPosition ofDividerAtIndex but did not succeed.

How can I specify either the width of the left subset or the position of the separator?

+6
source share
1 answer

The original size of the split view is based on restrictions. If there are no restrictions, then the width or height is 0. You are right, you cannot add any restrictions to the root view. You must add subviews that have restrictions that imply the desired height or width.

It could just be an NSView with a set width or height limit.

+7
source

Source: https://habr.com/ru/post/980190/


All Articles