1

我的应用应该只支持纵向模式,但在一个视图控制器中我希望能够使用横向。如果我将项目中支持的设备方向设置为仅纵向并运行应用程序 < iOS6.0 它工作正常,但在 iOS6 中它会崩溃:'UIApplicationInvalidInterfaceOrientation',原因:'支持的方向与应用程序没有共同的方向,并且 shouldAutorotate 是返回是。

即使我使用 shouldAutorotate (iOS6) 或 shouldAutorotateToInterfaceOrientation (pre iOS6),在项目属性中打开横向总是会旋转所有其他视图控制器。

有任何想法吗?

4

1 回答 1

3

知道了。用过这个

在项目设置中启用纵向和横向,在应用程序委托和覆盖中使用类别

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

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

在我的风景视图控制器中

于 2013-03-26T14:12:18.910 回答