2

I am planning to allow user to rotate the devices however during launch, i want the app start from landscape mode. May i know how can i do that?

Here is my code now for the orientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}
Undo
  • 25,519
  • 37
  • 106
  • 129
Clarence
  • 1,951
  • 2
  • 34
  • 49
  • This seems like a design red flag : User is in Portrait, launches app, something happens at a 90 degree angle, then app rotates back to Portrait? As a user, such an app would not instill confidence in its design. It's inconsistent : either an app is orientation-agnostic or it's not. –  May 23 '13 at 14:59

2 Answers2

2

You need to check the orientation of the status bar.

Please check the following links :-

Force iOS app to launch in landscape mode

Modal View Controller force Landscape orientation in iOS 6

Force Landscape Orientation on iOS 6 in Objective-C

Community
  • 1
  • 1
IronManGill
  • 7,222
  • 2
  • 31
  • 52
1

In the Project settings/target settings (the blue icon towards the top of the navigation bar on the left, in xcode), there are settings for specifying the orientation. You'll see 4 images, each of which can be selected or deselected. Select only the one that you want initially for your app, and then you can use the shouldAutorotate and supportedInterfaceOrientation methods to allow or disallow certain orientations.
Supported interface orientations are also specified in the plist. Makes sure to keep the initial orientation for the app at the top of that supoortedInterfaceOrientations list in the plist file.

neeraj
  • 1,191
  • 4
  • 19
  • 47