[英]Correct way to propagate shouldAutorotate into a deep modal viewcontroller in iOS6
[英]ViewController not rotating on iOS6
我的大多數應用程序都不支持輪換。 在支持的方向上,我僅選擇了肖像。 在應用程序使用的UIViewController子類上,我有以下內容:
-(BOOL)shouldAutorotate {
return NO;
}
-(NSUInteger)supportedInterfaceOrientations {
NSLog(@"supported?");
return UIInterfaceOrientationMaskPortrait;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
NSLog(@"preferred");
return UIInterfaceOrientationPortrait;
}
在不支持方向的UIViewController子類中,我有以下內容:
-(BOOL)shouldAutorotate {
return YES;
}
-(NSUInteger)supportedInterfaceOrientations {
NSLog(@"supported?");
return UIInterfaceOrientationMaskAll;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
NSLog(@"preferred");
return UIInterfaceOrientationPortrait;
}
但是,我的應用程序不會在任何視圖(包括該視圖)上旋轉。 我要如何使其旋轉到這里?
如果您使用的是導航控制器,請確保在“應用程序委托”中執行此操作:
self.window.rootViewController = self.navigationController;
有關其他參考,請從SO中檢查以下問題:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.