0

まず、この質問は私の問題を解決しないと言いたい: RootViewController を設定するときの向きの問題

私の iPad アプリケーションは横向きモードでしか動作しません。ルート コントローラを変更すると、新しいストーリーボードが正しく表示されます。ただし、ポートレート モードで表示され、正しい向きに回転します。ルート コントローラーを変更する前に向きを指定したり、ストーリーボードをデフォルトで横向きに表示するように指定したりするにはどうすればよいですか? アニメーションの直後にビューの回転を見るのはかなり醜いです。

また、プロジェクトのプロパティで左右のランドスケープを設定します。

ルートView Controllerを変更したときのコードは次のとおりです。

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

新しいルートViewControllerの?このようなもの:

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscape
}

これは、iOS 用の View Controller Programming Guideからのものです。

編集: わかりました、アニメーションを取り除こうとするのはどうですか?

于 2013-01-29T13:34:14.183 に答える