UIView in iOS 5 using storyboard does not rotate content on iPad device rotation

I am just starting out with Storiesboards and iOS 5.1. The application that I create uses the navigation controller as its root controller and is intended to be used in landscape orientation (this is my own corporate application).

I created a single view that worked correctly: the content rotates correctly to remain "right side up" when the simulator changes orientation.

Then I added a new view and that it does not rotate at all; the content remains in portrait orientation (and therefore sideways) when the device rotates.

I looked at the settings for the two UIViewControllers and UIViews and I see no difference between them. Any thoughts on where I should look?

+5
source share
2 answers

First of all, every UIViewController in the storyboard must have a class associated with it. Create a new class that inherits from the UIViewController, and then, in the storyboard, click on the uiviewcontroller and at the bottom of this controller, right-click and the class inspector, replace the UIViewController with the name of the new class you created.

Then, make sure that in each class of the view controller that you create, you implement the method

-(BOOL)shouldAutoRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

Just do this deletion method to return YES to EVERY view controller to make sure all of their views rotate in any orientation. Did you do it?

+9
source

. iPad-, iPad. . UITabBarController . , , shouldAutoRotateToInterfaceOrientation, (5 ) . , .

2 ¢.

0

All Articles