Introduction
In this article I will try to teach you how to set the screen orientation of an iPhone. In other words, when we make an application in Portrait mode and test in the device, it's content position changes when we move the device into Landscape mode. To understand that use the following procedure.
Step 1
Open ViewController.Xib and click on the top side of the Property window of Xcode. Select file inspector and Unmark "Use Autolayout".
Initially, mark "Use Autolayout":
Here unmark "Use Autolayout":
Step 2
Now click on the Size inspector at the top side of the Property window:
Step 3
Here we set Position (Autosizeing) of all outlets one by one.
First I select Username Label and set it's size according to Coordinate (x, y). Here I fix it's right side:
Now I select the Text field of the username and fix it's middle portion:
Now select the Login button and fix it's frame and bounds according to coordinates:
Step 4
Check the output in the Simulator .
Output
Output 1 (Portrait mode) in iPhone:
Output 2 (Landscape Mode) before the set Orientation in the iPhone:
Output 3 (Landscape Mode) after the set Orientation in the iPhone: