title: iPad: Move UIView with animation, then move it back
body: <p>I have the following code in a UIView subclass that will move it off the screen with an animation:</p>
  
  <pre><code>float currentX = xposition; //variables that store where the UIView is located
  float currentY = yposition;
  
  float targetX = -5.0f - self.width;
  float targetY = -5.0f - self.height;
  
  moveX = targetX - currentX; //stored as an instance variable so I can hang on to it and move it back
  moveY = targetY - currentY;
  
  [UIView beginAnimations:@"UIBase Hide" context:nil];
  [UIView setAnimationDuration:duration]; 
  self.transform = CGAffineTransformMakeTranslation(moveX,moveY);
  [UIView commitAnimations];
  </code></pre>
  
  <p>It works just great. I've changed targetX/Y to 0 to see if it does indeed move to the specified point, and it does. </p>
  
  <p>The problem is when I try and move the view back to where it was originally:</p>
  
  <pre><code>moveX = -moveX;
  moveY = -moveY;
  
  [UIView beginAnimations:@"UIBase Show" context:nil];
  [UIView setAnimationDuration:duration];
  self.transform = CGAffineTransformMakeTranslation(moveX,moveY);
  [UIView commitAnimations];
  </code></pre>
  
  <p>This puts the UIView about 3x as far as it should. So the view usually gets put off the right side of the screen (depending on where it is).</p>
  
  <p>Is there something with the CGAffineTransforMakeTranslation function that I should know? I read the documentation, and from what I can tell, it should be doing what I'm expecting it to do.</p>
  
  <p>Anyone have a suggestion of how to fix this? Thanks.</p>