cocoa - Using autolayout, how can I center a subview in an NSSplitView without forcing the width NSSplitView to be static? -
i have nssplitview content in both nsviews. left nsview has 2 constraints – equal widths
, equal heights
. right nsview has simple, nstextfield, centered via constraints center x alignment
, center y alighment
. hoped resize window and/or nssplitview divider:
this what's happening:
i've tried great deal of configuration changes, i've tried using nssplitviewcontroller vs dropping nssplitview nsviewcontroller adjust more parameters programmatically, i'm not having luck. whenever resizing window, left view takes on excess space. same happens divider (it can resized, letting go of mouse button causes snap right back). seems there's fundamental i'm missing here.
the text field's content hugging priority higher split view item's holding priority. fix , view should work way expect.
also, if, when resize view, left view resizing window while right view stays same size, suggests left view's holding priority may higher right's. should make side want stay same size have higher holding priority.
that said, i'm not sure mean constraints you've set on subviews. "the left nsview
has 2 constraints – equal widths
, equal heights
." mean here? width equal what? height equal what? mean has aspect ratio constraint? frankly, can't think of constraints of kinds make sense view within split view.
Comments
Post a Comment