Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different Device Orientation according to device (iPhone or iPad)

I'm working on a Universal project with these requirements:

  • For iPhone, I want only the portrait orientation.
  • For iPad, only landscapes.

How do I do that for iOS 8 (Swift)?

like image 763
insetoman Avatar asked Apr 16 '15 02:04

insetoman


1 Answers

Following the advice of @ScarletMerlin , changing the keys in info.plist is, in my opinion, the best solution for the requirements I have to fulfill (fixed orientation type for each kind of device).

Here is a print screen from the settings I use. Maybe it can help other developers with similar doubt.

Settings in info.plist file

The relavent source code looks like this:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
like image 166
insetoman Avatar answered Nov 11 '22 07:11

insetoman