Home>

When I nested StackView, I couldn't get the expected behavior.

UIStackView is nested in the following layout.
On top of the yellow base view is a Spacing10 StackView.
Furthermore, the view of the yellow base and the view of the green base are summarized in StackView.

The expected behavior is when the green base view becomes Hidden in this layout
The yellow base view extends to the bottom of the green base view
I want the blue views lined up with Spacing10 in the yellow base view to line up at equal intervals.

It may be a little difficult to communicate, but I would appreciate it if you could tell me.

Error message

The current behavior is as follows when the green view becomes Hidden:
The yellow view will be tormented to the part where the green view existed.

I tried various changes to StackView Distribution.

  • Answer # 1

    -Correction--

    Ah ~ I'm biting a yellow view, so let's stretch the constraints of the yellow view to match the outer StackView.
    The yellow view does not expand or contract in the outer StackView, it seems to move up and down with a fixed height

    ----Strikethrough

    If the top and bottom of the outer StackView are fixed, the contents will expand and contract.
    After that, if you play around with it, I think Iker.