Swift 为UINavigationController替换ViewController制作动画

Swift 为UINavigationController替换ViewController制作动画,swift,uiviewcontroller,uinavigationcontroller,presentviewcontroller,Swift,Uiviewcontroller,Uinavigationcontroller,Presentviewcontroller,我有一个菜单,允许用户在视图堆栈之间切换。我想做的是让UINavigationController通过幻灯片动画从一个堆栈切换到下一个堆栈 因此,要将一个视图添加到当前堆栈中,我知道我可以这样做: self.navigationController!.pushViewController(myController, animated: true) 将视图滑动到堆栈上,设置动画 我知道我能做到 self.navigationController!.viewControllers = newCon

我有一个菜单,允许用户在视图堆栈之间切换。我想做的是让UINavigationController通过幻灯片动画从一个堆栈切换到下一个堆栈

因此,要将一个视图添加到当前堆栈中,我知道我可以这样做:

self.navigationController!.pushViewController(myController, animated: true)
将视图滑动到堆栈上,设置动画

我知道我能做到

self.navigationController!.viewControllers = newControllersStack
但这并没有动画效果,而且感觉很粗糙,因为它只是在没有任何适当流的情况下注入堆栈流。我想做的是

self.navigationController!.changeViewControllers(newControllersStack, animated: true)

有办法做到这一点吗?我已经查看了选项卡栏,但我必须隐藏选项卡(使用侧菜单进行导航),即使这样,它也会为UINavigationController之间的过渡设置动画,而不是单个导航控制器内部的视图。

使用
UINavigationController.SetViewController(uuU2;:动画:)
使用
UINavigationController.SetViewController((动画:)

关于
UINavigationController.setViewControllers((动画:)
?这是一个反模式。在导航堆栈中,用户希望能够以到达当前控制器的相同顺序遍历堆栈。我不建议以这种方式替换堆栈。@LeoNatan Well shit。我怎么会错过这个。添加它作为答案,我会接受。这看起来正是我需要的。在我的情况下,这个有道理。这是一个新的导航堆栈,类似于选项卡控制器,当他们从侧菜单中选择某个内容时。很酷。添加为答案。将在5@LeoNatan中接受。你做得太快了,我还没有达到接受答案的可接受时间范围。关于
UINavigationController.setViewControllers(quo;:动画:)
?这是一个反模式。在导航堆栈中,用户希望能够以到达当前控制器的相同顺序遍历堆栈。我不建议以这种方式替换堆栈。@LeoNatan Well shit。我怎么会错过这个。添加它作为答案,我会接受。这看起来正是我需要的。在我的情况下,这个有道理。这是一个新的导航堆栈,类似于选项卡控制器,当他们从侧菜单中选择某个内容时。很酷。添加为答案。将在5@LeoNatan中接受。你做得太快了,我还没有达到接受答案的可接受时间范围。