How can I disable landscape orientation?

后端 未结 9 2165
忘掉有多难
忘掉有多难 2020-12-02 22:53

I am making an iPhone app and I need it to be in portrait mode, so if the user moves the device sideways, it does not automatically rotate. How can I do this?

9条回答
  •  误落风尘
    2020-12-02 23:36

    Xcode 4 and below

    For those who missed it: you can use the project settings screen to fix orientations throughout the app (no need to override methods in every controller):

    enter image description here

    It's as simple as toggling the supported interface orientations. You can find by clicking on your Project in the left panel > the app target > Summary tab.

提交回复
热议问题