title: Iphone-How to rotate image continuously for 30 secs and stop at 180 degrees
body: <p>I have this so far. I want the image to rotate for about 30 seconds and come to a stop and then face the other way.</p>
  
  <p>edit. Changed the code. I have this but it rotates and doesnt stop 180 degrees. I want it to rotate several times and come to stop in the opposite direction.       </p>
  
  <pre><code>       CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
    animation.duration = 0.60;//animation.duration = 0.60;
    animation.repeatCount = 1;//animation.repeatCount = 1000ˆ
  
  //#warning remove comment brackets below
  
    animation.keyTimes = [NSArray arrayWithObjects:
                          [NSNumber numberWithFloat:0.0],
                          [NSNumber numberWithFloat:1.0], nil];
  
    animation.values = [NSArray arrayWithObjects:
                        [NSNumber numberWithFloat:0.0],
                        [NSNumber numberWithFloat:(degrees / 180)*M_PI], nil];
  
    animation.fillMode = kCAFillModeForwards;
  </code></pre>
  
  <p>How can I stop the animation with the image still rotated 180 degrees.  </p>