我正在开发一个 iOS 应用程序,它实际上是一个现有 Web 应用程序的包装器。它添加了一些只能通过这种方式实现的附加功能。

我使用大小类和布局约束完成了应用程序的设计。我为 iPhone 和 iPad 使用了一个 Storyboard。问题是,我希望 iPhone 应用程序只能使用纵向模式,而 iPad 可能只能使用横向模式(有针对 iPhone 和 iPad 优化的不同 Web 应用程序)。

是否可以只使用一个 Storyboard来做到这一点,或者我是否需要使用两个 Storyboard(一个用于 iPhone,仅设置为纵向;另一个用于 iPad,仅设置为横向);因此复制我的设计?

最佳答案

打开您的 info.plist 文件作为代码并粘贴此代码:

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

对我来说效果很好!

关于ios - 一个 Storyboard中 iPhone 和 iPad 的不同方向,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27589641/

10-14 21:40
查看更多