title: Pause and Play CAKeyFrameAnimation in iOS
body: <p>I'm doing animation for calayer using CAkeyframeanimation.Actually i`m moving the calayer using the position property by using the CAkeyframeanimation.I want to pause the calayer moving animation.When i tap the screen it should resumes from where it paused.</p>
  
  <p>I added two animations for a calayer.One is for changing the bounds property of the calayer another one is position property.so i am using two animation for a single calayer but i want to pause the position property animation of the calayer util i tap the screen. After i tapped it should resumes from the paused position. </p>
  
  <p>I used the following code but it stops all animations which i applied to the calayer.</p>
  
  <pre><code>      - (void) pauseLayer: (CALayer *) theLayer
         {  
           CFTimeInterval mediaTime = CACurrentMediaTime();
           CFTimeInterval pausedTime = [theLayer convertTime: mediaTime fromLayer: nil];
           theLayer.speed = 0.0;
           theLayer.timeOffset = pausedTime;
          }
  
           - (void) removePauseForLayer: (CALayer *) theLayer;
           {
             theLayer.speed = 1.0;
             theLayer.timeOffset = 0.0;
             theLayer.beginTime = 0.0;
           }
           - (void) resumeLayer: (CALayer *) theLayer;
           {
             CFTimeInterval pausedTime = [theLayer timeOffset];
             [self removePauseForLayer: theLayer];
             CFTimeInterval mediaTime = CACurrentMediaTime();
             CFTimeInterval timeSincePause = [theLayer convertTime: mediaTime fromLayer:nil] - pausedTime;
             theLayer.beginTime = timeSincePause;
  
            }
  </code></pre>
  
  <p>I also tried the remove animation property of the CAanimtion.It works!! but i cant able to resume the animation from the paused the position.</p>
  
  <p>Please help me. </p>
  
  <p>Thanks in Advance.</p>