Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ios

rotation

since iOS 8 my App runs quite good, but I found a Problem while testing this app. It just happens on iPad and only if I launch the app in landscape mode. If it launches in Portrait everything is right(no rotation issues). If i rotate the Device (simulator or real device) the view rotates out of the screen and just shows a Cut of the real view and the rest is black.

enter image description here

enter image description here

Anyone else did notice such a bug? How can I fix it?

like image 541
Tristan G Avatar asked Oct 23 '14 08:10

Tristan G


2 Answers

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];
    }
like image 112
Mitech Avatar answered Nov 09 '22 03:11

Mitech


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?

like image 44
Rinto Rapheal Avatar answered Nov 09 '22 02:11

Rinto Rapheal