Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
Code:
[UIView beginAnimations:@"theAnimation" context:NULL];
[UIView setAnimationDuration:5.25];

[UIView setAnimationRepeatCount:FLT_MAX];
/*
or [UIView setAnimationRepeatAutoreverses:YES]:
*/

[UIView setAnimationDelegate:self];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];

//view to animate

[UIView commitAnimations];

the above code sets off an animation that repeats forever. how can i tell it to stop or pause?

[EDIT] ok, so i managed to stop the animation by creating a new animation block targeting the same UIView, and making sure i could call [UIView setAnimationBeginsFromCurrentState:YES]; on the first, moving animation. for the stop animation block, i simply set the repeat count to 1, the duration to 0 seconds, and the view to which ever position i wanted it to stop or pause at... it's too bad there wasn't an easier way of achieving this with a simple stop command.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.