Reputation: 12351
I have some code which causes a UIImageView
to rotate 180 degrees when the user touches the image. Unfortunately, when the user touches it again nothing happens. I'm assuming that it is determined that the image has already been rotated 180 degrees and that might be why it's not moving again. How do i solve this problem, thanks.
-(void) spinSun
{
[UIView animateWithDuration:2.0f animations:^{
imgSun.transform = CGAffineTransformMakeRotation(-3.142);
} completion:^(BOOL finished) {
}];
}
Upvotes: 1
Views: 175
Reputation: 100543
You have to create a new transformation matrix:
imgSun.transform = CGAffineTransformRotate(imgSun.transform, -3.142)
Upvotes: 5