When I tried to animate moving a button from position A to position B. I set the speed to 2.0, but sometimes it can get to position B, sometimes it can't which is "playBtn.frame = CGRectMake(startX, 28.0, 37, 37);" It's inconsistent for the animation ending position. Could anyone help to answer what's the problem? How to make it animate consistently? Thank you!
The following is my code:
float speed=2.0;
// set the position where button will start from playBtn.frame = CGRectMake(startX, 350.0, 37, 37);
NSLog(@"speed%f", speed); UIButton beginAnimations:nil context:playBtn; UIButton setAnimationDuration:speed; UIButton setAnimationDelegate:self; UIView setAnimationDidStopSelector:@selector(onAnimationComplete:finished:context:);
// set the position where button will move to playBtn.frame = CGRectMake(startX, 28.0, 37, 37);
UIButton commitAnimations;
iPhone OS 3.0