Krish Wadhwana
Krish Wadhwana

Reputation: 1544

Set device orientation as landscape for iPad only

I want landscape left and landscape right to be allowed on the iPad only, and not on the iPhone. How should I do this? Thanks in advance.

Upvotes: 0

Views: 63

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89569

Modify your info.plist file to have entries that look something like this:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

More information about those keys can be seen in this Apple documentation and I worked up the answer by looking at this public repo's info.plist file (though it's from iOS 3.2, I did try it out on sample project and it seems to still work fine).

Upvotes: 1

Related Questions