Simulated Metrics
Fortunately there is a way to do this. To see, open the MainStoryboard.storyboard file again. Then, select "Hello World View Controller" in the Document Outline, and then open the Attributes Inspector for the view controller. Finally, expand the "Simulated Metrics":
The "Orientation" drop-down is shown above, circled in red. Select the "Landscape" option to rotate the interface to Landscape position:
Yay! Now we can test changes to the HelloWorld interface without having to build and launch the app every time. Restore the original setting by selecting "Inferred" from the drop-down.
Supported Device Orientations
In Deploying to your iPhone, recall we used Xcode to set the "App Icon" for HelloWorld. This setting appeared within the Summary panel for the HelloWorld project. At the time, you may have noticed the "Supported Device Orientations" setting just above it:
The "Supported Device Orientations" buttons represent each of the four iPhone orientations, and can be toggled on and off independently of each other. They correspond to the "Supported interface orientations" in the Info panel:
Notice that this setting is actually an array of values. The order in which the buttons are toggled will change the order of the elements in this array. To confirm, return to the Summary panel and un-select all the "Supported Device Orientations". Then re-select a few and confirm the order of the "Supported interface orientations" changes accordingly.
What is this used for? As described in Information Property List Keys: UIKit Keys, the system uses the "Supported Device Orientations" setting in conjunction with the current device position to choose the initial orientation in which to launch the application. In other words, the list specifies a ranking of orientations to attempt upon launch. (This applies to apps running in iOS Simulator as well as on a physical device.) After launch, the application will handle rotation itself via the shouldAutorotateToInterfaceOrientation method, as explained in Orientations I.
We shall try some different launch orientations in the next post.