Why in iOS 8 my app at launch take wrong orientation? Why in iOS 8 my app at launch take wrong orientation? ios ios

Why in iOS 8 my app at launch take wrong orientation?

Please try the following code

In the didFinishLaunchingWithOptions of AppDelegate

self.window.rootViewController = self.viewController;[self.window makeKeyAndVisible];[self.window setFrame:[[UIScreen mainScreen] bounds]]; //Add

The issue seems to be the order of calls when you set up the window. You need to call makeKeyAndVisible before you assign the rootViewController in your didFinishLaunchingWithOptions method on the app delegate. The following works:

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];[self.window makeKeyAndVisible];self.window.rootViewController = self.myMainViewController;

But if you change the order to:

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];self.window.rootViewController = self.myMainViewController;[self.window makeKeyAndVisible];

You get the behavior you are experiencing.

I had the same exact problem with a "Loading screen". This is what worked for me. (Please note: my App only supports iOS 7 or later, landscape mode.) :

    CGRect theFrame = self.view.frame;    if ([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0) {        CGRect screenBounds = [[UIScreen mainScreen] bounds];        theFrame.origin = CGPointZero;        theFrame.size.width = screenBounds.size.height;        theFrame.size.height = screenBounds.size.width;    }    NSLog(@"%@", [NSNumber valueWithCGRect:theFrame]);    self.loadingScreen = [[UIView alloc] initWithFrame:theFrame];

Please refer to Mike Hay's answer if your App supports portrait orientation and for the "long way to calculate the correct applicationFrame":https://stackoverflow.com/a/18072095/4108485

Hope this helps.