Wednesday, March 21, 2012

Starting iOS application in desired orientation

I have an storyboard based application, and I noticed that when I started the application on iPhone, it always started on landscape, then after the application started it would then autorotate to portrait if the cell phone was in portrait mode. When I ran the application on the iPad instead, it would always start on portrait. So I searched the web to find how to fix it, and by examining some posts about it and tinkering a little with Xcode, I found the following solution to the problem: Inside the application target, there's a -Info.plist file. This file contains some configuration properties of the application. Among those, there's a "Supported interface orientations" property for both iPhone and iPad. My configuration for the iphone was the following: 

Item 0 Landscape (left home button)
Item 1 Landscape (right home button)
Item 2 Portrait (button home button)
I found out that the order of these items matter. The application will always start on the first orientation in this list. I was then able to solve my problem by dragging the Portrait (button home button) to the top of the list so that it turned into Item 0. Then, after I started my application again, it started in Portrait by default. Just posting in the case that someone has the same problem.

1 comment:


  1. The IOS is a best platform which provides great servicing and development of personalized enterprise app. Go with Ios application development training in Chennai to get indepth knowledge about IOS and its related application.

    ReplyDelete