4

I looked at UIStackView and I don't understand how it can be used with the Resize Class. I would like to have a imageView and a textView inside stackView in vertical (portrait) mode. I would also like to have the same thing, but in horizontal (landscape) mode.

I can detect the rotation and I change the orientation of the stack. Is this correct?

William Kinaan
  • 28,059
  • 20
  • 85
  • 118
Cristiano Alves
  • 233
  • 1
  • 13

1 Answers1

4

The best way to change your stack view between portrait and landscape mode using size classes is the following:

  1. Select your stack view in storyboard and look at the attribute inspector: enter image description here
  2. Click on the plus button next to the attribute you want to change when in landscape and select any width, compact height: enter image description here
  3. Finally, set the attribute for what you want when the device is rotated for instance: enter image description here

Hope this answers your question. Cheers!

Rob Norback
  • 6,401
  • 2
  • 34
  • 38
  • Thanks Rob, You really helped. In the end of this tutorial (http://www.raywenderlich.com/114552/uistackview-tutorial-introducing-stack-views) explains this too. – Cristiano Alves Sep 17 '15 at 10:47