0
votes

I have a UINavigationController with a first ViewController that is a UITabBarController, that should not be rotating... Then pushed UIViewController should rotate...

So far I have subclassed the UINavigationController and implemented those method :

- (BOOL) shouldAutorotate {
    return [self.visibleViewController shouldAutorotate];
}

- (NSUInteger)supportedInterfaceOrientations {
    return [self.visibleViewController supportedInterfaceOrientations];
}

So it is the child controller that choose if it should autorotate... I have so far managed to block rotation for UITabBarController and allow rotation for the pushed UIViewController.

The Only thing is, if the UIViewController is in landscape mode, and when I pop it, the UITabBarController will be in Landscape mode too, until the phone is put on the portrait mode, it will come back to normal and not rotate anymore...

I would like that when I pop the Landscape UIViewController, that the UITabBarController is already on portrait mode.

This new iOS 6.0 UI rotation management seems to be a pain !

1

1 Answers

0
votes

As you rightly say, the device has not been rotated, so the revealed view controller does not insist on rotating the orientation when the old view controller is popped. If that's the behavior you want, use a presented view controller instead.

You can force interface rotation by rotating the status bar, but only if supportedInterfaceOrientations returns 0.