Force iPad to run in portrait when landscape is supported

In my iPad application, there is one view somewhere in the application that supports landscape mode.

In order for the name wasAutorotateToInterfaceOrientation to be called in this view, I had to declare in info.plist that the landscape is supported.

Problem:

The UITabController, which is displayed when the application starts, does not support landscape mode, and I definitely specified it in all view controllers in the panel. However, when the application launches when the device is in landscape mode, the tabcontroller is displayed in landscape orientation and all the tabs look distorted.

Setting info.plist to support portrait mode only causes the application to start correctly, but then mustAutorotateToInterfaceOrientation is ignored on the rotating view controller.

Another option I tried at startup:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait]; 

In fact, this caused the application to appear in the portrait, but also caused the application to ignore further rotation of the device on the rotating view manager.

Update: This is only an iOS6 issue and cannot be seen on the simulator.

+2
source share
1 answer

Check it out iOS 6: are supportedInterfaceOrientations not working?

You need to subclass your TabBarController and override its mustAutoRotateToInterfaceOrientation to control how this oriented ViewController is oriented.

+2
source

All Articles