Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8.3 - Interactive Transitions Ignores UIView Animation Completion Block?

Tags:

ios

swift

uiview

Ever since I updated my device to iOS 8.3, I have not been able to get an interactive transition to complete.

It appears that when I call cancelInteractiveTransition() or finishInteractiveTransition(), the completion block in the animator's completion block, which contains the line:

transitionContext.completeTransition(!transitionContext.transitionWasCancelled())

is not called at all most of the time. This causes the entire application to stop reacting to touch and rotation events.

I'm using a subclass of UIPercentDrivenInteractiveTransition. cancelInteractiveTransition() and finishInteractiveTransition() are called when its pan gesture recognizer is in the state .Ended or .Cancelled.

Is this a bug in iOS 8.3 (since this issue only happened to me after 8.3), or am I doing it wrong?

like image 956
vincent_pun Avatar asked Apr 24 '15 08:04

vincent_pun


1 Answers

Try to override animationDidStop and call it from there

  override func animationDidStop(anim: CAAnimation!, finished flag: Bool) {
    self.transitionContext?.completeTransition(!self.transitionContext!.transitionWasCancelled())
  }

I hope that help you!

like image 147
Icaro Avatar answered Nov 15 '22 22:11

Icaro