1

My application is running in landscape mode. I want it to launch always in this orientation:enter image description here

If you are holding it the other way when it launches it should flip, but without the rotation animation. How do i achieve that?

Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161

2 Answers2

1

When launching application, You can check current orientation with:

UIDevice myDevice = [UIDevice currentDevice]; 

[myDevice beginGeneratingDeviceOrientationNotifications]; 

UIDeviceOrientation currentOrientation = [myDevice orientation]; 

Device orientation can be:

typedef enum {
   UIDeviceOrientationUnknown,
   UIDeviceOrientationPortrait,
   UIDeviceOrientationPortraitUpsideDown,
   UIDeviceOrientationLandscapeLeft,
   UIDeviceOrientationLandscapeRight,
   UIDeviceOrientationFaceUp,
   UIDeviceOrientationFaceDown
} UIDeviceOrientation;

Once You know it should be rotated,

You can - use this answer: UINavigationController Force Rotate

Or - if only iOS 5 and up is supported: https://stackoverflow.com/a/9827763/894671

Or - if iOS 6 only: https://stackoverflow.com/a/12691744/894671

Good luck!

Community
  • 1
  • 1
Guntis Treulands
  • 4,764
  • 2
  • 50
  • 72
-1

If you only want to use Landscape Right, you should simply unselect Landscape Left.

However, note that Apple may knock your submission back, as they tend to like orientations being supported where possible.

Paul Gregory
  • 1,733
  • 19
  • 25