Portrait mode only-iOS

落花浮王杯 提交于 2019-12-01 07:47:19

问题


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, I dont want my screen orinetation changes accordingly.

Any ideas how to do it?


回答1:


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);
}




回答2:


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.



来源:https://stackoverflow.com/questions/12901628/portrait-mode-only-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!