I am using this code
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
{
[self presentViewController:navigationControllerCustom animated:YES completion:nil];
}
else
{
[self presentModalViewController:navigationControllerCustom animated:YES];
}
My application has two orientation Portrait and Portrait upside down. This code works well with iOS 5.1, but orientation does not work on iOS 6
I have also added this code on my navigationControllerCustom class
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
-(NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
Please help me to solve this issue.
Thanks in advance.
You must include this in you application delegate:
Also make sure the View Controller’s both have the following, works fine for me.
The documentation also says that
UINavigationController'sdoesn’t query its top View Controller for orientations supported, although an Apple engineer over on the Developer Forums did say so… it seems that it does not. Therefore you should add a category forUINavigationController, this is the one I use:For more information how AutoRotate works on iOS 6 check out this answer