title: Cannot get current position of CALayer during animation
body: <p>I am trying to achieve an animation that when you hold down a button it animates a block down, and when you release, it animates it back up to the original position, but I cannot obtain the current position of the animating block no matter what. Here is my code:</p>
  
  <pre><code>-(IBAction)moveDown:(id)sender{
  
     CGRect position = [[container.layer presentationLayer] frame];
  
      [movePath moveToPoint:CGPointMake(container.frame.origin.x, position.y)];
  
      [movePath addLineToPoint:CGPointMake(container.frame.origin.x, 310)];
  
      CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
      moveAnim.path = movePath.CGPath;
      moveAnim.removedOnCompletion = NO;
      moveAnim.fillMode = kCAFillModeForwards;
  
  
      CAAnimationGroup *animGroup = [CAAnimationGroup animation];
      animGroup.animations = [NSArray arrayWithObjects:moveAnim, nil];
      animGroup.duration = 2.0;
      animGroup.removedOnCompletion = NO;
      animGroup.fillMode = kCAFillModeForwards;
  
      [container.layer addAnimation:animGroup forKey:nil];
  }
  -(IBAction)moveUp:(id)sender{
       CGRect position = [[container.layer presentationLayer] frame];
  
      UIBezierPath *movePath = [UIBezierPath bezierPath];
  
      [movePath moveToPoint:CGPointMake(container.frame.origin.x, position.y)];
  
      [movePath addLineToPoint:CGPointMake(container.frame.origin.x, 115)];
  
      CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
      moveAnim.path = movePath.CGPath;
      moveAnim.removedOnCompletion = NO;
      moveAnim.fillMode = kCAFillModeForwards;
  
      CAAnimationGroup *animGroup = [CAAnimationGroup animation];
      animGroup.animations = [NSArray arrayWithObjects:moveAnim, nil];
      animGroup.duration = 2.0;
      animGroup.removedOnCompletion = NO;
      animGroup.fillMode = kCAFillModeForwards;
  
      [container.layer addAnimation:animGroup forKey:nil];
  
  }
  </code></pre>
  
  <p>But the line </p>
  
  <pre><code>   CGRect position = [[container.layer presentationLayer] frame];
  </code></pre>
  
  <p>is only returning the destination position not the current position. I need to basically give me the current position of the container thats animating once I release the button, so I can perform the next animation. What I have now does not work.</p>