1
我有UITabBarController
子類處理旋轉問題:的UITabBarController presentmodal自動旋轉問題
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
return [self.selectedViewController supportedInterfaceOrientations];
}
-(BOOL)shouldAutorotate{
return YES;
}
從
tabbatcontroller
的
UIViewController
的一個
,現在我提出一個新的UIViewController
:
MainVC *mainVC = [[MainVC alloc] initWithNibName:@"MainVC" bundle:nil];
UINavigationController *mainNav = [[UINavigationController alloc] initWithRootViewController:mainVC];
radioNav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:mainNav animated:YES];
而且在這個新的導航,我想禁用自動旋轉,只允許肖像:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
-(BOOL)shouldAutorotate{
return NO;
}
但旋轉仍然工作,當我旋轉屏幕的應用程序轉到橫向屏幕,我該如何解決這個問題?
您需要檢查每一次當前設備的方向或設備狀態欄始發: - 請檢查我的答案: - http://stackoverflow.com/questions/16710899/force-portrait-in-one-view-controller-makes-other-to-be-in-portrait -initially/16711127#16711127 –