title: how to spin an image continuously
body: <p>I have an wheel image in .png format, I want to know how can i animate so that it rotates continuously, I searched on stackoverflow and found certain snippets of code which helped me rotate my image but it wouldn't rotate continuously, it would just rotate for a few seconds and stop, the code as follows </p>
  
  <p>the code in <strong>viewdidload</strong> </p>
  
  <pre><code>UIImageView *imageToMove =
  [[UIImageView alloc] initWithImage:[UIImageimageNamed:@"horo_circle.png"]];
  [self.view addSubview:imageToMove];
  
  [self rotateImage:imageToMove duration:5.0 
              curve:UIViewAnimationCurveEaseIn degrees:180];
  </code></pre>
  
  <p>and the animation </p>
  
  <pre><code>- (void)rotateImage:(UIImageView *)image duration:(NSTimeInterval)duration 
            curve:(int)curve degrees:(CGFloat)degrees
  {
      // Setup the animation
      [UIView beginAnimations:nil context:NULL];
      [UIView setAnimationDuration:duration];
      [UIView setAnimationCurve:curve];
      [UIView setAnimationBeginsFromCurrentState:YES];
  
      // The transform matrix
      CGAffineTransform transform = 
      CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(degrees));
      image.transform = transform;
  
      // Commit the changes
      [UIView commitAnimations];
  }
  </code></pre>
  
  <p>and the following lines after the import </p>
  
  <pre><code>#define M_PI   3.14159265358979323846264338327950288   /* pi */
  
  #define DEGREES_TO_RADIANS(angle) (angle / 180.0 * M_PI)
  </code></pre>