-3

i want to rotate my imageView in my iOS app 360 degree from its center

(when my label text is "hello")

please help me

if ([myLabel.text isEqualToString:@"hello"] == YES)
{
    //here i want the imageView to rotate

}
user3091937
  • 31
  • 1
  • 8

2 Answers2

5

It seems you want it animated. Otherwise, there is no change in image view.

#define DEGREES_IN_RADIANS(x) (M_PI * x / 180.0);

[UIView animateWithDuration:duration animations:^{

imageView.transform = CGAffineTransformMakeRotation(DEGREES_IN_RADIANS(360));

} completion:nil];
user2734323
  • 706
  • 1
  • 8
  • 19
1

myLabel.transform = CGAffineTransformMakeRotation(degrees * M_PI / 180.0);

If you want ti have it animated, wrap it in an animation block:

[UIView animateWithDuration:duration animations:^{

} completion:nil];
Christian Schnorr
  • 10,768
  • 8
  • 48
  • 83