UIViewPropertyAnimator losing animation block after completion

430 Views Asked by At

I have a UIViewPropertyAnimator to control the present and dismiss animation of a loading view.

My loading view starts in an alpha of zero and a scale transform to make it smaller. Than, in the animation block, I change this values to the final values (alpha of one and identity transform). Than, in the dismiss process I set the animator to reverse.

The present animation works fine, and if i reverse the animator (dismiss the loading) in the middle of animation it works ok.

My problem is that, if the animation completes the presentation and I try to reverse and start animation again, I get the error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An animator (UIViewPropertyAnimator [inactive] interruptible) must have at least one animation block to start!'

Do I have to reset the animation block every time the animator completes?

0

There are 0 best solutions below