Right和UIInterfaceOrientation

Right和UIInterfaceOrientation

本文介绍了我想仅支持UIInterfaceOrientationLandscapeRight和UIInterfaceOrientationLandscapeLeft的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确保不支持UIInterfaceOrientationPortraitRight和UIInterfaceOrientationPortraitLeft。

how do I make sure that UIInterfaceOrientationPortraitRight and UIInterfaceOrientationPortraitLeft are not supported.

基本上我希望我的应用程序仅用于UIInterfaceOrientationLandscapeRight和UIInterfaceOrientationLandscapeLeft

Basically I want my application to be used ONLY in UIInterfaceOrientationLandscapeRight and UIInterfaceOrientationLandscapeLeft

我编辑了Info.plist文件

I edited the Info.plist file

<string>MainWindow</string>
 <key>UISupportedInterfaceOrientations</key>
 <array>          
      <string>UIInterfaceOrientationLandscapeLeft</string>
      <string>UIInterfaceOrientationLandscapeRight</string>
 </array>


推荐答案

确保每个 UIViewController / UITabBarController 等,在 shouldAutoRotateToInterfaceOrientation 中,返回显示 return((interfaceOrientation == UIInterfaceOrientationLandscapeLeft)||(interfaceOrientation == UIInterfaceOrientationLandscapeRight));。

Make sure that in every UIViewController/UITabBarController etc., in the shouldAutoRotateToInterfaceOrientation, the return says return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));.

这篇关于我想仅支持UIInterfaceOrientationLandscapeRight和UIInterfaceOrientationLandscapeLeft的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 22:00