如何仅在xcode中使用风景

时间:2018-07-28 03:39:54

标签: ios xcode9

我不希望我的应用将左侧的方向更改为横向,但如果用户更改屏幕的方向,则只需将其保持在右侧即可。我该怎么办?

2 个答案:

答案 0 :(得分:0)

在您应用的常规设置下,转到部署信息,取消选中左图

enter image description here

答案 1 :(得分:0)

如果您要对屏幕方向进行更具体的控制,只需覆盖控制器的-supportedInterfaceOrientations

Objective-C

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscapeRight;
}

迅速

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.landscapeRight
}