kx tt kx tt - 1 year ago 84
Swift Question

How to get Show segue's timing function and duration

I want to add an animation to my

so that it will move along with show segue. How do I get the default timing function and duration for show segue?

Here is my code:

let transition=CATransition()
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
myUIView.layer.addAnimation(transition, forKey: nil)

However my view's entering animation is not completely synchronized with the show segue's animation.

Answer Source

The easiest way is to use UIViewController's transitionCoordinator and call animateAlongsideTransition:completion: which is documented in UIViewControllerTransitionCoordinator. viewWillAppear is usually a good place to do this.

You can then run any animations you want along with the default animation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download