I have a custom view that should track the location of a user. I put the following code in touchesBegan
as well as in touchesMoved
:
[UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ cursorView.center = locationOfTouch; } completion:^(BOOL finished){}];
It seems pretty simple to me. I expect that the view will always animate the user's current location, even if that location is changed, and the view is still animating (due to the beginFromCurrentState option).
However, each animation is fully completed. They do not "switch" to a new animation, they do not end first, and then begin a new animation.
I tried adding this line to touchesMoved
:
[cursorView.layer removeAllAnimations]
Doing nothing. No animation is canceled. Any ideas?
source share