iOS6: supportedInterfaceOrientations not working (is invoked but the interface still rotates)
Solution 1:
If your are using a UINavigationController as the root window controller, it will be its shouldAutorotate
& supportedInterfaceOrientations
which would be called.
Idem if you are using a UITabBarController, and so on.
So the thing to do is to subclass your navigation/tabbar controller and override its shouldAutorotate
& supportedInterfaceOrientations
methods.
Solution 2:
try change this code in AppDelegate.m
// self.window.rootViewController = self.navigationController;
[window setRootViewController:navigationController];
this is the complete answer
shouldAutorotateToInterfaceOrientation not being called in iOS 6
XD
Solution 3:
In my case I have UINavigationController and my view controller inside. I had to subclass UINavigationController and, in order to support only Portrait, add this method:
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
So in the UINavigationController subclass I need to check which orientation is supported by the current topViewController.
- (NSUInteger)supportedInterfaceOrientations
{
return [[self topViewController] supportedInterfaceOrientations];
}