Before few years ago,It was very hard to make UI in both orientations but now with size classes & Xcode 8 it’s very easy to do.
Let’s understand the basic concept
There are two size classes that can be applied to the horizontal (width) or vertical (height) dimension
The iPhone 6 Plus and iPhone 7 Plus are the only iPhone devices with a regular width in landscape orientation as you can see in below image [right side]. The bigger size is always regular and the small size is always compact.
Let’s open main storyboard, at bottom is toolbar appearing with all devices icon repeat to size class.
We will change component position based on orientation.
First in portrait mode , Drag image view & label in view controller & set content according.
Now, Let go step by step, Make sure you select portrait mode
- Select the vary for traits button in toolbar that will open one dialog pop up. There are two variations height & width.
- Select height & width in pop up that will change toolbar in blue color & also change device icon according size class in panel.
- Set all constraints for ImageView & Label
- Click on done in toolbar panel
Cheers!!!…Here our first step is finished & portrait layout set according size class.
Now we set landscape mode
Now run project & check it.