5

I have a horizontal UIStackView with 2 views within it. I'd like to have the left view take up ~70% of the screen, and the right view take up the remaining 30%. I know that I can set the UIStackView alignment to Fill and the distribution to Fill and that will allow me to have more control over my subview sizes. What I can't figure out is how to set the layout constraints/widths/etc. on the subviews so that the the 70/30 ratio is correct, particularly when the device is rotated?

Can anyone explain how to set the constraints on my subviews so that the 70/30 ratio is maintained across device rotations?

Léo Natan
  • 56,823
  • 9
  • 150
  • 195
Shadowman
  • 11,150
  • 19
  • 100
  • 198
  • 4
    Create an equal width constraint between the two views and set the multiplier to 70/30 – dan Apr 11 '16 at 20:54

1 Answers1

2

You should be able to do this by creating an equal width constraint for the two views. Then, set the multiplier to that constraint to 0.7.

Chris Garrett
  • 4,824
  • 1
  • 34
  • 49