简体   繁体   English

将设备方向设置为仅适用于iPad的横向

[英]Set device orientation as landscape for iPad only

I want landscape left and landscape right to be allowed on the iPad only, and not on the iPhone. 我希望只在iPad上允许左横向和右横向,而在iPhone上不允许。 How should I do this? 我应该怎么做? Thanks in advance. 提前致谢。

Modify your info.plist file to have entries that look something like this: 修改info.plist文件,使其具有类似于以下内容的条目:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

More information about those keys can be seen in this Apple documentation and I worked up the answer by looking at this public repo's info.plist file (though it's from iOS 3.2, I did try it out on sample project and it seems to still work fine). 有关这些键的更多信息可以在Apple文档中找到 ,我通过查看此公共仓库的info.plist文件 (尽管它来自iOS 3.2,但我确实在示例项目中进行了尝试,并且仍然可以正常工作)解决了问题的答案。 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM