仅限肖像模式 – iOS

我有一个应用程序,只为纵向devise。 但是,我不知道如何限制只使用肖像模式,一旦用户颠倒或空间模式,我不希望我的屏幕orignation相应的变化。

任何想法如何做到这一点?

这可以在应用程序摘要中指定(也可以在rootviewcontroller(无论是Nav Controller,TabBar Controller等)中通过重写此方法来指定:

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

在这里输入图像说明

以下是可以在XCode 8.1中进行更改的位置的更新视图

设置应用程序方向 请注意,您可以select项目导航器顶部最左侧的项目(应用程序摘要)。 然后,在右侧,您需要确保在顶部select常规,然后在需要时向下滚动,您将看到设备方向设置。

xcode 8.1