Search code examples
iphoneiosipaduiviewcontrolleruiinterfaceorientation

Iphone app doesn't respond after starting in landscape


I've got a very strange behavior in my iPhone app.

The app should run in any orientation. Plist keys are all set and shouldAutorotateToInterfaceOrientation always returns YES.

Also, it's an iPhone only app, but at this moment I can test it only on the iPad.

Now, when I start it in portrait mode, everything works fine. However, if it launches in landscape mode, the view doesn't receive any touch input, buttons and gestures simply don't work. This is happening as long as the window remains unaltered. If I rotate the app and then rotate it back to landscape, it works. Moreover, if I press the "2x" button on the iPad, the app also starts to work normally.

I've checked all view frames and everything is drawn correctly.

When run in simulator, it ignores the initial orientation and draws itself in portrait mode.

What can be the reason and how to solve it?


Solution

  • I have found that this is unique to iOS 6 (you'll see this on iPads running iOS 6 and even the iOS 6 iPad simulator, but not devices/simulator running iOS 5). If you remove all of the entries under "Supported interface orientation" in the app's plist, this problem seems to go away. Alternatively, if you check the "Hide during application launch" option for the "Status Bar" settings on the Summary screen of the Target settings, this also fixes it:

    enter image description here

    It makes no sense why either of these should fix the bug, but they appear to.

    If you use the "Supported Orientations" tweak, in iOS 6, you can still programmatically control the permitted interface orientations via supportedInterfaceOrientations (in iOS 5, you can still useshouldAutorotateToInterfaceOrientation:).