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. There is also an easy-to-use interface for changing this value: select the project from the project navigator, then the HeavyRotation target from ...

Get iOS Programming: The Big Nerd Ranch Guide, Second Edition 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.