Building project with Xcode 6 (iOS 8 SDK) causes l

2020-05-07 04:59发布

问题:

We have a project that behaves as desired when built using Xcode 5.1.1 (iOS sdk 7.2), but when build using Xcode 6.2 (iOS sdk 8.2) there is a rotation rendering issue on the iPad. On the iPad our app only supports landscape left and landscape right. When you rotate from one to the other, on the rotation animation the screen rotates from upside down to right side up, but when it does this it lands in the wrong position. (The bottom-left corner of the screen ends up approximately 200 pixels up from the bottom and an equal number of pixels inset from the left.)

This may also happen on iPhone, but on iPhone we only support portrait so rotation isn't an issue.

One additional piece of info, if I build with Xcode 6 but run on an iPad with iOS 7 there is NO issue. This ONLY happens when I build with Xcode 6 and run on an iPad with iOS 7.

Has anyone else seen then behaviour and know what the root cause may be?

I found another Question on stack overflow where someone else has the EXACT same problem. Their screenshots show the EXACT rendering misplacement on the rotate as the app I'm working on. Here is a link to that other question. (Frustratingly, it appears no one has answered the question, and none of the suggestions have given me a solution.)

Here is the link to the other questions that shows the same bug as me: Is this an iOS 8 Bug (orientation issue on rotation)?

回答1:

I found the answer to my problem. 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.