Is this an iOS 8 bug (rotation orientation issue)?

since the iOS 8 application works pretty well, but I found a problem when testing this application. It just happens on the iPad, and only if I launched the application in landscape mode. If it starts in the "Portrait", everything is correct (there are no problems with rotation). If I rotate the device (simulator or real device), the view rotates from the screen and just shows the cutout of the real view, and the rest are black.

enter image description here

enter image description here

Has anyone else noticed such an error? How can i fix this?

+5
source share
4 answers

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

Commented on the initialization of self.window and its purpose. Set the initial view in the storyboard in the attribute inspector by checking the "Is the initial view controller" checkbox.

New best solution
Commenting on self.window caused other problems. Instead, the best code is:

- (void)applicationDidChangeStatusBarOrientation:(NSNotification *)notification { [UIViewController attemptRotationToDeviceOrientation]; } 
+4
source
 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: 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 that there is a change in the height and width of the screen in portrait and landscape orientation from ios8 onwards.

Check this link [UIScreen mainScreen] .bounds.size becomes orientation dependent in iOS8?

+2
source

UPDATE - fix found:

I found the answer to our problem, which, as described below, turned out to be exactly the same as yours. One of our developers noticed an "unexpected zero in the main window" when trying to click on the far right of the screen. This led me to a new search, and I found this thread in stackoverflow, which actually contained the answer to our problem.

(here is a link to a question that helps me answer: unexpected nil window in _UIApplicationHandleEventFromQueueEvent )

The actual answer came from a frankish who suggested opening main.xib (or the main storyboard) and clicking on the window in it and making sure that the properties "Visible at startup" and "Full screen at startup" are checked (set to true.)

In our case, it was ONLY the “Full Screen on Startup” property that needed to be set, but installing it, fixing the rotation problem that we observed, and it fixed the problem when the screen was not tangible when starting up on the iPad in the landscape.

END UPDATE - (source unanswered below)

My answer is not an answer, but I ran into the same problem. When turning in our application when building with Xcode 6, I see the same rendering problem as the screenshots on this subject. Exactly the same position does not rotate with black stripes on the side and bottom. (Our application on the iPhone does not support any rotation, so we don’t see a problem on the iPhone. On the iPad, we support the landscape on the left and right. When turning from one to the other, when the iPad makes a standard rotation animation, it will rotate from position (showing black stripes), when it goes one way, and then turns back to the correct position, returning to a different supported orientation. I do not believe that this is related to any user positioning or animation code. screen, including screen saver. It seems that this is connected but with Apple’s built-in screen rotation. It’s obvious that not every project has this problem in iOS, but I didn’t encounter features that cause this problem. I spent all day yesterday researching to issue and pass through our code, and I have nothing .

One additional information. If I create using Xcode 6 and run on a device with iOS 7, then this is not a problem. This issue ONLY arises when I build with Xcode 6 and run on an iOS 8 device.

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

Construction project with Xcode 6 (iOS 8 SDK) causes rotation rendering problem on iPad

+2
source

I found this to be a problem when there were multiple windows in my application. By setting a breakpoint at -[UIWindow setFrame:] , I was able to see that after rotation the system gave me the wrong size and position of the frame. You can get around this by manually setting the frame to [UIScreen mainScreen] bounds] , which seems correct if you are running on iOS7 + and compiling with Xcode6. I found that doing this in -[UIWindow becomeKeyWindow] works fine for me:

 - (void)becomeKeyWindow { [super becomeKeyWindow]; self.frame = [UIScreen mainScreen].bounds; } 
0
source

Source: https://habr.com/ru/post/1205339/


All Articles