在 UIViewController 上启用接口方向



可能的重复项:
应该自动旋转到界面方向在 iOS 6 中不起作用

我使用的是 xcode 4.5,我只需要在一个包含 webview 的视图控制器上启用界面方向。我怎样才能启用它。

- (BOOL)shouldAutorotateToInterfaceOrientation似乎在iOS6中已弃用

相反,

您可以使用此UIViewController

-(BOOL) shouldAutorotate{
        return YES; //supports all
    }
    -(NSUInteger) supportedInterfaceOrientations{
        return UIInterfaceOrientationMaskAllButUpsideDown; //supports all but upside-down
}

此 API 在 iOS 6 中不再有效。您无法启用它。查看@Shivan猛禽分享的链接

最新更新