I currently have a view animating from one part of the screen to another. I want the animation to pause whenever the "pause" button is pressed. This means the animation needs to remain right where it is (frame location) when I "pause" the animation. I've tried a few things but nothing has given me the result I want. Below is a rough version of my current code.
-(IBAction)startScroll
{
NSLog(@"Start scroll");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:30];
//set new frame for view
[UIView commitAnimations];
}
and one method to stop the animation
-(IBAction)pauseScroll
{
NSLog(@"Pause Scroll");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:0.1];
//Pause animation in it's current location
[UIView commitAnimations];
}