Forcing Landscape Mode

If your application only makes sense in landscape mode, you can force it to run that way. First, in your view controller implement shouldAutorotateToInterfaceOrientation: to only return YES for landscape orientations.

-​ ​(​B​O​O​L​)​s​h​o​u​l​d​A​u​t​o​r​o​t​a​t​e​T​o​I​n​t​e​r​f​a​c​e​O​r​i​e​n​t​a​t​i​o​n​:​(​U​I​I​n​t​e​r​f​a​c​e​O​r​i​e​n​t​a​t​i​o​n​)​x​
{​
 ​ ​ ​ ​r​e​t​u​r​n​ ​U​I​I​n​t​e​r​f​a​c​e​O​r​i​e​n​t​a​t​i​o​n​I​s​L​a​n​d​s​c​a​p​e​(​x​)​;​
}​

An application’s Info.plist contains a key-value pair that specifies the valid initial orientations of the application. Select the project from the project navigator, then the HeavyRotation target from the editor area, and finally the Summary pane.

Figure 8.12  Choosing ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.