How can I disable landscape orientation?

后端 未结 9 2172
忘掉有多难
忘掉有多难 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:30

    Removing the method shouldAutorotateToInterfaceOrientation from your class entirely also works. If you don't plan on rotating then it makes no sense to have the method in your class, the less code the better, keeps things clean.

提交回复
热议问题