supportedInterfaceOrientations method not working on iOS 6 UIViewController
The method shouldAutorotateToInterfaceOrientation: is NOT supported in iOS 6. Its deprecated.
Apple provides a new method to get this thing done, in a much cleaner. You use supportedInterfaceOrientations instead. It returns all of the interface orientations that the view controller supports, a mask of interface orientation values.
In iOS 5, I used the method to change my orientation:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (UIInterfaceOrientationIsPortrait(interfaceOrientation));
}
In iOS 6 , I’m using:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
Also, in your delegate, I replaced this: [window addSubview:viewController.view];
With this: [window setRootViewController:viewController];
Via: http://kriptonitapps.com/supportedinterfaceorientations-method-not-working-on-ios-6-uiviewcontroller/
supportedInterfaceOrientations method not working on iOS 6 UIViewController
Reviewed by Unknown
on
12:04
Rating:
No hay comentarios: