问题描述
我想知道是否有一种方法可以减慢'push segue&像Tinder& Snapchat确实如此.就像正常的segue,但它以某种方式缓慢地过渡.
I was wondering if there is a way to slow down 'push segue & back' like Tinder & Snapchat does. It's like normal segue but it's somehow transiting slowly.
我通常通过在Storyboard上设置Push通知并以编程方式调用segue(单击NavBarItem并将其推送到新的UIViewController)来处理push segues :
I normally handle push segues with setting up a Push notification on Storyboard and programatically calling the segue (clicked on NavBarItem and push segued to new UIViewController):
func settingsTapped() {
performSegueWithIdentifier("NewsToSettings", sender: nil)
}
有一种方法
It there a way to
-
为整个应用启用全局减慢速度吗?
enable slowing down segue globally for the whole app?
还是我应该每次都按部就班?如果是这样,适当的方法是什么?
or should I do it maually for each segue? If so, what is the appropriate way?
推荐答案
如前所述,您只需编写自定义过渡动画.给导航控制器一个委托并实现navigationController:animationControllerForOperation:fromViewController:toViewController:
.基本上,您只需要提供一个实现UIViewControllerAnimatedTransitioning协议的对象即可.作为其中的一部分,您可以指定动画的持续时间.
As you've been told, you simply write a custom transition animation. Give the navigation controller a delegate and implement navigationController:animationControllerForOperation:fromViewController:toViewController:
. Basically then you just supply an object that implements the UIViewControllerAnimatedTransitioning protocol. As part of that, you get to specify the animation duration.
如果所有导航控制器都具有相同的委托,或者如果所有委托都提供了相同的UIViewControllerAnimatedTransitioning对象,则所有push/pop转换将使用相同的代码,并且将以相同的方式工作.
If all your navigation controllers have this same delegate, or if all the delegates supply this same UIViewControllerAnimatedTransitioning object, all push / pop transitions will use the same code and will work the same way.
这篇关于减慢推推转场的过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!