2016-09-14 94 views
0

我嘗試實現iOS應用程序特定的視圖控制器始終僅打開橫向模式。我在viewWillAppear中添加下面的代碼。iOS - iPad Air和iPad Pro僅在橫向設備中強制設備方向

NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight]; 
[[UIDevice currentDevice] setValue:value forKey:@"orientation"]; 

上述編碼細工作下列設備iPhone 4S/5/5秒/ 6/6秒和ipad 2 /視網膜。但iPad Air/Air 2/Pro不工作。如何解決這個問題。請指導我謝謝。在您的視圖控制器下面

回答

0

相反設備方向使用:

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{ 
    return UIInterfaceOrientationMaskLandscape; 
} 
+0

@傑格迪什感謝您的回覆..我也找到了一些變通的解決方案..我有啓動肖像,並需要在靶全屏模式 - 設備方向..然後上面的編碼工作良好.. – Raj

+0

好吧..所以這不是你想要的..我誤解你的問題? – jagdish

相關問題