0

首先,我想说这个问题并没有解决我的问题:Orientation problem when I set a RootViewController

我的 ipad 应用程序只能在横向模式下工作。当我更改根控制器时,新的故事板会正确显示。但是,它以纵向模式出现,然后旋转到正确的方向。如何在更改根控制器之前指定方向或告诉故事板默认以横向显示?在动画之后看到视图的旋转非常难看。

此外,左右景观在项目属性中设置。

这是我更改根视图控制器时的代码。

UIStoryboard *editorStoryboard = [UIStoryboard storyboardWithName:@"EditorStoryboard" bundle:nil];
UISplitViewController *editorViewController = [editorStoryboard instantiateInitialViewController];

UINavigationController *navigationController = [editorViewController.viewControllers lastObject];
editorViewController.delegate = (id)navigationController.topViewController;


AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;

[UIView transitionWithView:appDelegate.window duration:0.5 options: UIViewAnimationOptionTransitionFlipFromLeft animations:^{
    appDelegate.window.rootViewController = editorViewController;
} completion:nil];
4

1 回答 1

0

您是否尝试覆盖

PreferredInterfaceOrientationForPresentation

对于新的根视图控制器?像这样的东西:

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscape
}

这来自iOS 的 View Controller Programming Guide

编辑:好的,尝试摆脱动画怎么样?

于 2013-01-29T13:34:14.183 回答