Rotating a UIButton with a custom image (animation)

Posted by Tiago on Stack Overflow See other posts from Stack Overflow or by Tiago
Published on 2010-05-26T03:18:34Z Indexed on 2010/05/26 3:21 UTC
Read the original article Hit count: 678

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?

© Stack Overflow or respective owner

Related posts about animation

Related posts about core-graphics