1
我曾嘗試:如何強制iOS 10中的視圖控制器方向?
- >子類的UINavigationController和壓倒一切的自動旋轉方法
- 上MyViewController
>重寫自動旋轉方法- >而且兩者。
注:另外,我試圖用自動旋轉套NO和YES
這是我的代碼:
NavigationControllerNoAutorotate:
@implementation NavigationControllerNoAutorotate
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationPortrait;
}
- (BOOL)shouldAutorotate {
return YES;
}
@end
MyViewController:
- (BOOL)shouldAutorotate {
return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController {
return UIInterfaceOrientationPortrait;
}
的問題是,我是在iPad上測試解決方案,我激活了部署信息的SPLITVIEW。當「需要全屏顯示」爲「是」時,分屏視圖將被禁用。 –
我在這個鏈接上找到了解決方案:[link] http://stackoverflow.com/questions/32782044/ios-9-supportedinterfaceorientations-not-working –