【发布时间】:2013-01-13 01:59:39
【问题描述】:
首先我想说这个问题并没有解决我的问题: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];
【问题讨论】:
-
您是否检查了应用程序目标摘要中的
Supported Interface Orientations仅选择了Landscape Left或Landscape Right(根据您的需要) -
是的,已经检查过了,忘记添加了
-
如果它们被选中,详细信息将保存在 Info.plist 中,因此应用程序最初将以纵向模式加载。所以只选择横向模式
-
我的意思是检查左右横向。
-
我找到了答案。这是工作正常。 [stackoverflow.com/questions/8053832/…[1]:stackoverflow.com/questions/8053832/…
标签: ios objective-c ipad user-interface