iphone - 我只想支持 UIInterfaceOrientationLandscapeRight 和 UIInterfaceOrientationLandscapeLeft

标签 iphone objective-c cocoa-touch ipad interface-builder

如何确保不支持 UIInterfaceOrientationPortraitRight 和 UIInterfaceOrientationPortraitLeft。

基本上我希望我的应用程序仅在 UIInterfaceOrientationLandscapeRight 和 UIInterfaceOrientationLandscapeLeft 中使用

我编辑了 Info.plist 文件

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

最佳答案

确保在每个 UIViewController/UITabBarController 等中,在 shouldAutoRotateToInterfaceOrientation 中,返回内容为 return ((interfaceOrientation = = UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));.

关于iphone - 我只想支持 UIInterfaceOrientationLandscapeRight 和 UIInterfaceOrientationLandscapeLeft,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2647607/

相关文章:

ios - 如何使用 Swift UI 将忽略安全区域的 MapView 与我的其余内容对齐?

iphone - 关于iPhone上URL中NSString字符无效的问题

objective-c - MFMailComposeViewController 抛出 viewServiceDidTerminateWithError 并在使用自定义标题字体时退出

ios - RestKit对象映射问题

iphone - 计算 Objective-C 中的网络时间协议(protocol)(偏移量)

iphone - 允许 UIBarButtonItem 触摸 UINavigationBar 的顶部和底部

ios - 如何快速组织uitableview的动态数量作为滑动页面

iphone - 如何更新 iPhone 应用程序上的 sqlite

iphone - iphone sdk支持从rtmp流播放mp4吗?

objective-c - 有没有一种简单的方法可以向后迭代 NSArray?