IOS 6 screen rotation without using storyboards

Anyone trying to use the latest beta version of iOS 6 (version 2 or 3) has the same auto spin experience that doesn't work?

I do not use a storyboard, but pure navigation control:

self.navController = [[UINavigationController alloc] initWithRootViewController:self.viewController]; [self.window addSubview:navController.view]; 

And there are:

 - (BOOL)shouldAutorotateToInterfaceOrientation: ](UIInterfaceOrientation)interfaceOrientation { if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } else { return YES; } } - (NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskAllButUpsideDown; } 

BUT IOS has no support, works great with all previous iOS on the 3GS / 4S simulator and 4.3.5.0.5.1, but iOS 6 just seems like a mistake

+7
source share
3 answers

The solution is this: Since my application is trying to support from 4.3+, I have to use a navigation controller for each switch.

from ios6 it seems to delegates to a navigation controller, I have to define my own navigation controller, and also set conditions and functions to change its rotation behavior.

When I load the view, I then do ([self.navigationCOntroller setEnableLandscape: (BOOL) false]). this way you have the full controller of your navigation controller.

NOTE. I tried to override the navigation controller methods, but it seems to be just ignored. (This only happens with ios 6.0), I haven't checked 6.1 yet, so I'm not sure if it is fixed (which please let me know if this happens)

0
source

Authorization changes in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: UIViewController deprecated. Instead, you should use the supportedInterfaceOrientations and shouldAutorotate .

Read more here .

+10
source

instead of [self.window addSubview:navController.view];

Insert self.window.rootViewController = navController;

+7
source

All Articles