How should I use auto layout constrains inside NSSplitView
subview?
My NSSplitView
subview has 3 subview: topPane
, tableCont
I load all by a nib file and setTranslatesAutoresizingMaskIntoConstraints:NO
afterwards.
So maybe you should first add by [mySplitView addSubview:myView];
your views and disable afterwards the translation of the autosizing mask to constraints and after this you add your contraint to myView
.
EDIT:
Ok it seems I missunderstand the myView. You have to add the constraint to the subviews and not to the splitview.
[topPane addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topPane(34)]" options:0 metrics:nil views:views]];
[bottomPane addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[bottomPane(24)]" options:0 metrics:nil views:views]];
You don't have to add edge constraints (the "|" in "V:|[topPane(34)]") because the subviews in NSSplitView
are already autoresizing.
This lead to this e.g. for the topPane constraint:
NOTE: ignore the subview content, they are just placeholders