Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application always launch in Landscape Left

In my application, supported orientations are Landscape Right & Landscape Left. Its single screen application. In ViewController I added following code to restrict orientation.

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

-(BOOL)shouldAutorotate
{
    return YES;
} 

My Problem is whenever app launches in Landscape Left. If device position Landscape Right, then app view rotate in 180 degree then app starts working in Landscape Right.

There is no issue if device position is Landscape Left.

Note: I am testing application on iPod 5.

EDIT:

After some observations, If you are supporting only Landscape (i.e Landscape Right & Landscape Left), then you will face this problem. Application will always open in orientation which listed first in plist (In my case that is Landscape Left).

I Closed this issue by removing Landscape Left orientation support. If any one have solution for this please share.

Thanks for help.

like image 342
OnkarK Avatar asked Feb 21 '14 05:02

OnkarK


People also ask

How do I turn off landscape mode in IOS?

Swipe down from the top-right corner of your screen to open Control Center. Tap the Portrait Orientation Lock button to make sure that it's off.

How do I turn off landscape mode in HTML?

In order to disable the landscape mode you need to add the following meta tag to your page header like so: Note: Please paste it at the top of your header. You can use the plugin call insert headers and footers to do so.

How do I force an app to landscape in IOS?

On an iPhone without a Home button, swipe down from the top-right corner of the screen instead. Here, tap on the rotation lock icon (which looks like a lock with a circular arrow) to turn it on or off.


1 Answers

I had the same problem, setting the 'Initial interface orientation' to UIInterfaceOrientationLandscapeLeft in the plist didn't work, nor did returning it in preferredInterfaceOrientationForPresentation in the view controller.

What solved this for me is reordering the 'Supported interface orientation' array in the plist to have my desired initial orientation as the first item in the array.

enter image description here

like image 97
Oferm Avatar answered Oct 22 '22 21:10

Oferm