How do I disable landscape-orientation on an iPad app?

后端 未结 8 1330
臣服心动
臣服心动 2021-02-01 12:41

I created a completely new, single-view iOS universal Swift app. Then, I unchecked \"Landscape Left\" and \"Landscape Right\" in the app settings. I ran it on my iPhone, and hoo

相关标签:
8条回答
  • 2021-02-01 13:21

    Works for me!

    Open info.plist as source code, you will see these properties:

    • UISupportedInterfaceOrientations : For iPhone
    • UISupportedInterfaceOrientations~ipad : For iPad

    Under UISupportedInterfaceOrientations~ipad remove your unwanted orientation mode. In my case, I want only Portrait Mode so I removed the rest modes and then save it.

    Done! Good Luck

    0 讨论(0)
  • 2021-02-01 13:21

    Using Xcode 11

    The iPhone orientation settings and iPad orientation settings can be set independently using the Deployment Info settings. No need exists to update the info.plist for orientation. Updating the Deployment Info will update info.plist for you. (This is not intuitive and may be overlooked)

    For example, set the iPhone deployment info by selecting only the iPhone.

    Then select the iPad deployment info by selecting only the iPad. Remove the landscape selections here.

    Then when finished, if you want both iPhone and iPad settings, select them both. The settings will remain for both iPhone and iPad even if they differ (iPhone's orientation settings are shown but iPad's remain).

    Flipping back to iPad only will show that the settings still remain.

    The info.plist will also reflect the changes made to iPhone and iPad using the Deployment Info.

    0 讨论(0)
提交回复
热议问题