IOS 6 error: supportedInterfaceOrientations is not called when the nav controller is used as the root of the window

In my mainwindow.xib I have a navigation controller. At the top (as a sub), I have another view manager (homeviewcontroller).

In nib, I installed window rootviewcontroller with such a navigation controller.

It deploys to the application store and works great.

Starting from the upgrade to ios6 sdk, I get orientation problems - basically with this design the supportedInterfaceOrientations method of my homeviewcontroller is not called when my application runs on the ios 6 device / simulator.

To fix this problem, I need to set the homeviewcontroller as the rootviewcontroller window, but this is not what I want - I need a navigation manager.

How do I get around this annoying bug in ios6?

Update:

I also tried doing this programmatically - it still doesn't work.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { HomeViewController *homeVC = [[HomeViewController alloc]init]; UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:homeVC]; [self.window setRootViewController:navController]; [self.window makeKeyAndVisible]; return YES; } 
+2
objective-c iphone xcode
Oct 12 '12 at 15:57
source share
3 answers

You need to subclass the UINavigationController and override the supported InterfaceOrientations there.

+7
Oct. 15 '12 at 10:12
source share

To develop @ phix23's answer, I wrote this tiny subclass of UINavigationController

 @implementation MyNavigationController - (NSUInteger) supportedInterfaceOrientations { return [[self topViewController] supportedInterfaceOrientations]; } @end 

From my understanding of the docs mentioned in his comment, this should be the default behavior. But somehow it works for me, and without it it doesn’t

+1
Feb 19 '13 at 15:59
source share

Do this programmatically at runtime? (In your delegate method, -applicationDidFinishLaunching:

0
Oct 12 '12 at 16:14
source share



All Articles