0

I am using the UIView animateWithDuration:delay:options:animations:completion: method but the completion method is never getting called. Here is my code:

[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^
             {
                 //random lines of code

             }completion:^(BOOL finished){
                 if (finished)
                 {
                     NSLog(@"FINISHED");
                 }
             }];

EDIT: When I comment out the lines in my animations: it gets called???!!!

These are the lines:

CGFloat objectY = object.frame.origin.y;
objectY += speed;
object.frame = CGRectMake(object.frame.origin.x, objectY, 75, 75);
Abdullah Shafique
  • 6,878
  • 8
  • 35
  • 70

1 Answers1

1

I am taking a guess - you want to animate the movement of a continuous gesture? If yes, the animation never ends due the user interaction.

Just update the frame, no UIView Animation. Should work just fine.

Helge Becker
  • 3,219
  • 1
  • 20
  • 33
  • I think what you're saying here is that removing the `UIViewAnimationOptionAllowUserInteraction` will allow the completion to be handled – bachonk Dec 09 '13 at 16:10
  • Maybe. Its to less code to tell what is actual happening. The UIViewAnimation you made is fine. Must be something interfering. Where comes the speed from or how often get this animation called for instance? Setting the origin of a frame in an animation is about moving a distance, but not speed. speed is distance divided by time, but you had something in mind when you did choose the name for the float. Like I said before, I am guessing:) – Helge Becker Dec 09 '13 at 16:17