Rotating a UIButton with a custom image (animation)
- by Tiago
Hi,
I'm trying to rotate a button that I've connected to the controller from the Interface Builder. I've set it's image right from Interface Builder. I'm using this code on the method that runs when I click it:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0];
[UIView setAnimationRepeatCount:5];
updateButton.transform = CGAffineTransformMakeRotation( M_PI );
[UIView commitAnimations];
But this doesn't do anything. Can this be done, or should I create the button programmatically in order to get it to rotate?