iOS 6: how to force change orientation when pushing view controller into the navigation controller stack
ios, ios6, orientation, uinavigationcontroller, xcode
Solution
I am also find the same problem.i have found that shouldAutorotate function not call every time so i change orientation programmatic
first import this
#import <objc/message.h>
then
-(void)viewDidAppear:(BOOL)animated
{
if(UIDeviceOrientationIsPortrait(self.interfaceOrientation)){
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
{
objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), UIInterfaceOrientationLandscapeLeft );
}
}
}
hope this help you.
Problem
I think this question should've been asked a million times by now, but I still can't find an answer to this. Here's my hierarchy: UINavigationController -> UIViewController 1 ->(push)-> UIViewController 2 UINavigationController: supports all possible orientation UIViewController 1: supports only portrait UIViewController 2: supports only landscape How can I lock UIViewController 1 into portrait only and at the same time lock UIViewController 2 into landscape only? Is it even possible? So far what I see is that UIViewController 2 always takes the orientation of UIViewController 1. Note, that this is for iOS 6 only. Thanks!