3

事实:

开发了一个 iPhone 应用程序,它通常是可旋转的,但每个视图根本不可旋转。我们只需要一个显式视图中的旋转功能,因此我们必须在一般情况下启用旋转。

现在,当您在 iPad 上安装该应用程序并以横向模式打开它时,该应用程序以横向模式显示,如果您转动 iPad,您将无法将其旋转回纵向(这似乎是合乎逻辑的,因为视图中不允许旋转)。

我在模拟器中没有遇到过这种情况:(

有人知道该怎么做吗?抱歉没有包含代码...

4

2 回答 2

2

尝试添加“支持的界面方向(iPad)”并确保“纵向底部主页按钮”是列表中的第一个。此外,修改您的根视图控制器,使其仅显示在纵向中。

于 2013-02-27T13:32:54.930 回答
0

除了 Mike M 的回答,我在 mi RootViewController 中有这个:

Objective-C

- (BOOL)shouldAutorotate {
    return NO;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

迅速

override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
    return UIInterfaceOrientation.Portrait
}

override func shouldAutorotate() -> Bool {
    return false
}

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.Portrait
}
于 2016-03-04T15:08:51.573 回答