Three20 在 iOS6 中自动旋转



我尝试在iOS6中自动旋转工作。我已经阅读了它,问题是,我无法为窗口设置rootviewcontroller。我试过了:

self.window.rootViewController = [[TTNavigator navigator] rootViewController];但是应用程序崩溃与无法识别的选择器...
在 iOS5 中,自动旋转与 shouldAutorotateToInterfaceOrientation 方法配合使用效果很好。

尝试以下操作:

[[UIApplication sharedApplication] keyWindow] setRootViewController:[[TTNavigator navigator] rootViewController]];

自动旋转随 iOS6 更改。是的,在iOS5中您使用了shouldAutorotateToInterfaceOrientation 。您仍然需要它来支持iOS5,但是要支持iOS6,请使用下面的新方法。

我认为这就是你所追求的。

#pragma mark - View Orientation
-(NSUInteger)supportedInterfaceOrientations {
// For iOS6
NSUInteger orientation = 0;
orientation |= UIInterfaceOrientationMaskPortrait;
orientation |= UIInterfaceOrientationMaskPortraitUpsideDown;
orientation |= UIInterfaceOrientationMaskLandscapeLeft;
orientation |= UIInterfaceOrientationMaskLandscapeRight;
return orientation;
}

然后注释掉或删除您不想支持的行。您可以在一行上按位"或"返回所需的方向。还有另外两个可用:

UIInterfaceOrientationMaskAllUIInterfaceOrientationMaskAllButUpsideDown

本教程对我有用: http://www.goodnewtiger.com/llf/cegeek/?p=61
我不得不更改TTNavigationController并在应用程序委托中设置视图控制器。

最新更新