0

I have an UIAnimation with duration, delay, options, animation and completion.

In the animation I'm just moving a view around by setting it's frame.

CGPoint newPoint;

newPoint = CGPointMake(x + offset, button.center.y);

And then in the completion block I return the view to it's original position which I've stored off somewhere.

completion:^(BOOL finished)
{
    view.center = oldPosition;
}

My problem is that when I'm moving the button around via a swipe gesture, the animation seems to fail half way done. I'm wondering what exactly would cancel a animation on a view if I never call [view.layer removeAllAnimations]. Is there anything going on behind the scenes that would cancel the animation(possibly another animation)?

EDIT: I'm really just wondering about if there is anything that UIAnimation blocks do behind the scenes that could possibly cause this behavior.

TheBinaryhood
  • 231
  • 2
  • 9
  • You could possibly be adding another animation for the same property while the previous animation is running. Add some breakpoints or logging in you animation block and completion block and see if they both run. – David Rönnqvist Jun 14 '12 at 20:10
  • My only issue is that I cannot reproduce this problem. Obviously something is triggering it but it just seems to be random. I've tried about every case I can think of and had other people attempt to trigger it. No luck. – TheBinaryhood Jun 15 '12 at 14:25
  • I don't know of anything would cause the animation to fail half way. The only "half way" problem I've experienced is when animating a pan, where I have to animate the completion of the user's intended pan (e.g. a flick of the finger). But that seems like a completely different issue. Perhaps you can post the code from your entire animation sequence and we can take a look at that. – Rob Jun 17 '12 at 18:10

0 Answers0