Is this an iOS 8 Bug (orientation issue on rotation)?

4 Solutions Collect From Internet About “Is this an iOS 8 Bug (orientation issue on rotation)?”

Had similar problem. Surprisingly the fix was to comment out all the code related to self.window on Appdelegate.

Commented initialising of self.window and its assignment. Set the initial view in storyboard in Attributes inspector by checking “Is Initial View Controller” checkbox.

New Better Solution

Commenting self.window was causing other issues. Instead the below code is best:

- (void)applicationDidChangeStatusBarOrientation:(NSNotification *)notification 
         [UIViewController attemptRotationToDeviceOrientation];
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
BOOL landscape = (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight);
NSLog(@"Currently landscape: %@, width: %.2f, height: %.2f", 
      (landscape ? @"Yes" : @"No"), 
      [[UIScreen mainScreen] bounds].size.width, 
      [[UIScreen mainScreen] bounds].size.height);

And the results are:
For iOS 8+

Currently landscape: No, width: 320.00, height: 568.00
Currently landscape: Yes, width: 568.00, height: 320.00

and for iOS 7-

Currently landscape: No, width: 320.00, height: 568.00
Currently landscape: Yes, width: 320.00, height: 568.00

It seems like there is a change in the way height and width of the screen is handled while in portrait and landscape from ios8 onwards.

Check this link
Is [UIScreen mainScreen].bounds.size becoming orientation-dependent in iOS8?

UPDATE – We found a fix:

I found the answer to our problem which as described below appeared to be exactly the same as yours. One of our other developers noticed an “unexpected nil in main window” when attempting to tap on the far right of the screen. This led me to do a new search and I found this thread on stackoverflow that actually contained the answer to our problem.

( here is the link to the question which help my answer: unexpected nil window in _UIApplicationHandleEventFromQueueEvent )

The actual answer came from frankish who suggested opening the main.xib (or main storyboard) and clicking on the Window in that and making sure that the “Visible at Launch” and “Full screen at Launch” properties are checked (set to true.)

In our case, it was JUST the “Full screen at Launch” property that needed to be set, but setting this fixed the rotation problem we were seeing AND it fixed an issue where when launching on iPad in landscape the far right of the screen was not touchable.

END UPDATE – (original non-answer below)

My answer isn’t an answer, but I have run into the exact same issue. On rotate in our app, when building with Xcode 6, I see the exact same rendering issue as the the screenshots on this question. The exact same out of position rotate with black bars at the side and bottom. (Our app on iPhone doesn’t support any rotation so we don’t see the issue on iPhone. On iPad we support landscape left and landscape right. When rotating from one to the other, when the iPad does it’s standard rotation animation, it will rotate out of position (showing the black bars) when going one way and then rotate back into proper position when going back to the other supported orientation. I don’t believe it’s related to any custom positioning or animation code. It happens with every screen, including the splash screen. It appears to be related to the built in Apple screen rotation. Obviously not every project has this issue in iOS but I have not come across the particulars that are causing this issue. I spent all day yesterday researching the issue and going through our code and I have nothing.

One piece of additional info. If I build with Xcode 6 and run on a device with iOS 7 then there is not issue. This issue ONLY happens when I build with Xcode 6 and run on a device with iOS 8.

Here is a link to my own question posted yesterday about this issue. (I did not come across this question until after I’d posted my question.)

Building project with Xcode 6 (iOS 8 SDK) causes landscape rotation rendering issue on iPad

I found this to be an issue when I had multiple windows in my application. By setting a breakpoint on -[UIWindow setFrame:], I was able to see that upon rotation, the system was giving me giving me an erroneous frame size and position. You can get around this by manually setting your frame to equal [UIScreen mainScreen] bounds] which seems to be correct if you running on iOS7+ and compiling with Xcode6. I found that doing this in -[UIWindow becomeKeyWindow] worked well for me:

- (void)becomeKeyWindow {
    [super becomeKeyWindow];

    self.frame = [UIScreen mainScreen].bounds;