Xcode Diaries #1 Device Orientation For iPhone, iPad

Recently I was asked to lock the device orientation to portrait only for an iOS Application.
Trusting Xcode blindly, I went to the Project Navigator -> Deployment Info and checked the portrait only mode as shown below:

xcode-deployment-info-screen-orientation

The above thing worked on my iPhone but not on the iPad. Once again, it reaffirmed the fact that looks can be deceiving!

Lesson for the day

Apparently setting the device orientation from the deployment info can really deceive you.

So, in order to set the device orientation always checkout the Info.plist file.
As you can see in the image below, the iPad device orientation didn’t change from the deployment info.
So you can go ahead and do the needful from this file.

xcode-device-orientation-info-plist

Uploading an app which supports only one orientation in iPad may be rejected by the App store with the following error:

Super tip of the day

If you want to lock down the iPad orientation to portrait only, you must set the UIRequiresFullScreen to true in the info.plist

That sums up this diary.

Leave a Reply

Your email address will not be published. Required fields are marked *