你可以动画setRootViewController吗? [英] Can you animate setRootViewController?

查看:100
本文介绍了你可以动画setRootViewController吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的SplitViewController不能作为导航控制器的一部分。我使用SetRootViewController在IBAction,这是罚款,但它不是动画。理想情况下,我想使用与导航控制器相同的动画(从左/右滑动),但如果这是不可能的,我想要使用一致的动画,当我需要这样做。

I'm using a SplitViewController which can't be part of a navigation controller. I'm using SetRootViewController on an IBAction, which is fine, but it's not animated. Ideally I'd like to use the same animation as the Navigation Controller does (slide in from the left/right) but if that's not possible I'd like to use a consistent animation when ever I need to do this.

推荐答案

我不知道这个,但我建议如下。

I'm not sure about this, but I would suggest the following.

UISplitViewController 设置为 UIWindow rootViewController 。在 viewDidLoad 中,您使用按钮的调用UIViewController 调用 presentModalViewController:animated:作为模态。确保你不动画它。这给了你的幻觉,模态视图是你看到当应用程序启动时的第一个。
当你按下按钮,你使用 dismissModalViewControllerAnimated:动画按钮的 UIViewController 现在你可以选择如何动画。您的选择之一是交叉解散。

Set the UISplitViewController as your UIWindow's rootViewController. In the viewDidLoad, you make a presentModalViewController:animated: call with the button's UIViewController as modal. Make sure you don't animate it. This gives you the illusion that the modal view is the first you see when the app launches. When you push the button, you animate the button's UIViewController out with dismissModalViewControllerAnimated:. Now you can choose how to animate. One of your choices is cross disolve.

这篇关于你可以动画setRootViewController吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆