根据设备(iPhone或iPad)的不同设备方向 [英] Different Device Orientation according to device (iPhone or iPad)
本文介绍了根据设备(iPhone或iPad)的不同设备方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个符合这些要求的环球项目:
I'm working on a Universal project with these requirements:
- 对于iPhone,我只想要纵向。
- 对于iPad,只有风景。
我如何为 iOS 8 (Swift)做到这一点?
How do I do that for iOS 8 (Swift)?
推荐答案
根据@ScarletMerlin的建议,在我看来,更改info.plist中的键是最好的解决方案。我必须满足的要求(每种设备的固定方向类型)。
Following the advice of @ScarletMerlin , changing the keys in info.plist is, in my opinion, the best solution for the requirements I have to fulfill (fixed orientation type for each kind of device).
这是我使用的设置的打印屏幕。也许它可以帮助其他有类似疑问的开发人员。
Here is a print screen from the settings I use. Maybe it can help other developers with similar doubt.
相关源代码如下所示:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
这篇关于根据设备(iPhone或iPad)的不同设备方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文