在iOS8上,我用如何在iPad Air2 iOS9.2的某些ViewController上強制屏幕方向?
- (BOOL)shouldAutorotate
{
return NO;
}
-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortrait;
}
但iOS9 iPad的AIR2不工作, 另外,我發現另一種解決方案,但沒有工作或者, 覆蓋自定義的UINavigationController以下功能:
-(UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return [self.viewControllers.lastObject supportedInterfaceOrientations];
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [self.viewControllers.lastObject preferredInterfaceOrientationForPresentation];
}
-(BOOL)shouldAutorotate{
return self.visibleViewController.shouldAutorotate;
}
燦誰來幫幫我?謝謝!
謝謝,但它不工作... –
你選擇從項目設置 – ali
我是否需要將其刪除所有其它的方向? –