tags:

views:

1583

answers:

2

Hello All,

Facing one issue with launching application in landscape orientation for IPad. I have developed IPhone application which later I ported to IPad.

I have made setting regarding orientation in info.plist

[ UISupportedInterfaceOrientations~ipad ] to support all orientation UIInterfaceOrientationPortrait , UIInterfaceOrientationPortraitUpsideDown , UIInterfaceOrientationLandscapeLeft , UIInterfaceOrientationLandscapeRight.

but when I start IPad application in the landscape mode, it always start in the potrait mode.

Along this

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{ return YES; }

help me, if I am missing something with this..

Thanks,

Sagar

+1  A: 

Sagar - I had the same issue but was able to resolve it.

Like yours, my app started as an iPhone app which I "upgraded" to a Universal app using the XCode wizard. I noticed that when running on the actual iPad, starting in landscape, the app would start in Portrait, then maybe rotate to Landscape. On the simulator, starting in landscape, the app would start in Landscape, then the simulator would rotate to Portrait.

On the iPad, my app is a split-view app with TabBarControllers on left and right. Each tab is a view controller that returns YES to shouldAutoRotateToInterfaceOrientation.

I noticed that a brand-new wizard-generated, simple-case with a splitviewcontroller, Universal app didn't have this problem.

The difference I found between my app and the simple-case was that I wasn't adding my splitview-controller's view to the app window in applicationDidFinishLaunchingWithOptions. Instead I was showing a "loading" view at this stage, then later when an initialization thread completed I'd add my splitviewcontroller's view (and hide the "loading" view).

When I added my splitviewcontroller's view to the app window during the call to applicationDidFinishLaunchingWithOptions everything started working fine.

There must be some magic that happens on return from applicationDidFinishLaunchingWithOptions???

Is your app similar to mine in that it isn't adding the main view controller's view to the window during applicationDidFinishLaunchingWithOptions?

TomSwift
Hi TomSwift. Thanks for reply.. I have implemented same way,as you have described. in applicationDidFinishLaunchingWithOptions I am not adding main window / infact I am adding splash screen and after that splitview is added.
Sagar Mane
So what happens if you add the main window instead of the splash screen? Does it fix itself?
TomSwift
See.. it seems solution for this is in applicationdidfinishlauching let the start default UI [ in my case splash scree ] and after that detect the orientation and do the view rendering....
Sagar Mane
A: 

Put UISupportedInterfaceOrientations into your -Info.plist, with a setting for each orientation you support. This is used to see which orientation the app can start in. From there onwards it will ask your view controllers.

David Atkinson
Thanks David for reply. Yes settings is implemented in info.plist.
Sagar Mane