5

I have vertical UIStackView which has two horizontal UIStackViews, if bottom UIStackView has larger width than UIStackView on the top then UIStackView on the top will be stretched to the width of the bottom UIStackView.

And now I have first element in the top UIStackView stretched, but I want to stretch last element.

Current:

enter image description here

Expected:

enter image description here

How can I achieve this?

konstantin_doncov
  • 2,725
  • 4
  • 40
  • 100
  • Not really clear what you want... Is the "outer" stack view a fixed width? Or does it stretch based on the length of "gtfdgsd..."? Is the bottom row two Buttons? Is the left Button a fixed-width? Or is it supposed to stretch? Or does it have a fixed left-right padding? You want both top-row labels to stretch based on content? What should happen if combined width of the two labels exceeds the width of the bottom row? – DonMag Jun 21 '17 at 18:07
  • @DonMag thanks for your comment. Outer stack view is stretch based on constraints. Yes, bottom stack has two buttons. Doesn't matter what bottom stack has, because I just want next simple behavior: Now, my first label fill all available space in the top stack, and all others labels fit to content, but I want last label to fill all available space, and all others(include first) fit to content, as it on the second picture. – konstantin_doncov Jun 21 '17 at 20:19

1 Answers1

12

Assuming your labels have the default Horizontal Content Hugging Priority set to 251 each, change the Green Label to 252

enter image description here

Everything else you should be able to leave as you have it.

DonMag
  • 69,424
  • 5
  • 50
  • 86