Portrait mode only-iOS

前端 未结 2 1297
花落未央
花落未央 2021-01-14 10:53

I have an application and designed for only for portrait orientation. However I dont know how to restrict to use only portrait mode, once user upside down or landspace mode,

相关标签:
2条回答
  • 2021-01-14 11:46

    Here's an updated view of the place where you can make the change in XCode 8.1

    Notice that you choose that item (App Summary) on the far left at the top of the project navigator. Then, on the right side you need to make sure that General is chosen at the top, then scroll down if needed and you'll see the Device Orientation settings.

    0 讨论(0)
  • 2021-01-14 11:52

    That can be specified in the App Summary (and also in the rootviewcontroller (whether that be a Nav Controller, TabBar Controller, etc) by overriding this method:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    

    enter image description here

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