I want to rotate a UIButton when connection start and want to stop rotating when connection stop.
So my question is how to start or stop rotation on UIButton.
I use the following code for rotation.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:5.0];
// (180 * M_PI) / 180 == M_PI, so just use M_PI
btn.transform = CGAffineTransformMakeRotation(M_PI);
[UIView commitAnimations];
You can remove animations from a view by calling
removeAllAnimationsMake sure you import QuartzCore before accessing layer properties, otherwise you may get a warning.
To make the view animate continuously use the
+ (void)setAnimationRepeatCount:(float)repeatCountmethod onUIViewand set it to some arbitrary high number.