9

I had the following custom transition using UIView.animateWithDuration(...usingSpringWithDamping:...) which worked perfectly.

UIView.animateWithDuration(self.transitionDuration(transitionContext),
    delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 1.0,
    options: nil, animations: {() in
    // ...
}, completion: {(Bool) in
    // ...
})

But then I had to extend my custom transition with UIViewControllerInteractiveTransitioning in order to have an interactive transition where the user can swipe down the modal view again.

Therefore I needed keyframes for the animation in order that the UIPercentDrivenInteractiveTransition works properly.

So I changed the animation function to use UIView.animateWithKeyframes....

UIView.animateKeyframesWithDuration(self.transitionDuration(transitionContext),
    delay: 0.0, options: UIViewKeyframeAnimationOptions.CalculationModeCubic,
    animations: {() in
    // ...
}, completion: {(Bool) in
    // ...
})

My problem now: I lost the spring animation.

I've checked several links, one of the most promising was:

... but with .addKeyframes... method I cannot specify a completion block that I need.

Any suggestions? :-/

Community
  • 1
  • 1
Chris
  • 3,057
  • 5
  • 37
  • 63
  • did you look at https://github.com/felixjendrusch/Marionette ? – Eran May 05 '15 at 07:27
  • as an aside, checkout this post on spring animations https://medium.com/@flyosity/your-spring-animations-are-bad-and-it-s-probably-apple-s-fault-784932e51733 – Max MacLeod May 08 '15 at 11:27

0 Answers0