iOS Auto Layout - How to have two stacked views in portrait move to side by side in landscape?

888 views Asked by At

I am updating my app and want to allow landscape orientation. I am wondering how I can take two views that are stacked on top of each other (and centered horizontally in container) while in portrait and move them to be side by side in landscape (and centered vertically in container).

I would like the bobblehead to be aligned on the left, and the quote box to be aligned on the right. Both views should take up full height while in landscape.

Here are some screen grabs: Portrait Mode Landscape Mode

1

There are 1 answers

0
Jageen On BEST ANSWER

What you want is having different layout when device size is not fit to your view.
In iOS8 you can do it without hard coding it.
Yes just by designing right constraint for right size class(introduce in XCode6)
Here is an example which doing same as you want Example


Code
Download project

Output enter image description here enter image description here