Question

I have implemented a view controller just for autorotation. So this view controller, which I called RotatableViewController, implements these methods:

- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

- (NSUInteger) supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

- (BOOL) shouldAutorotate {
    return YES;
}

It should autorotate to all orientations, I also have checked the supported interface orientations in my target:

enter image description here

But incredibly it doesn't autorotate in the portait upside down orientation:

enter image description here

What could be the problem?

PS With iOS 6.1 , the view controller is instantiated through a storyboard.

Was it helpful?

Solution

The problem is that you're using a UINavigationController, which does not support up side down by default on iPhones. As a general design principle, iPhone apps should not support upside-down (allegedly because the "lock" switch does lock landscape mode on the iPhone, unlike on the iPad). The upside-down orientation is designed for iPad devices only.

You could solve your problem by subclassing UINavigationController and use a supportedInterfaceOrientations that returns UIInterfaceOrientationMaskAll and specify that as the base class for your navigation controller in the storyboard. But I don't you should be doing that because apps on iPhone should generally not support upside-down portrait orientation.

OTHER TIPS

Older versions had the problem with UIInterfaceOrientationMaskAll. Not sure which version you are using. Try redoing with all the orientations.

- (NSUInteger) supportedInterfaceOrientations
{
    return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top