title: CALayer position and anchorpoint
body: <p>I've already done a lot of work with animating CALayers, but I never really understood the positioning system completely. Most of the time I just try, how it turns out. </p>
  
  <p>I know the <code>anchorPoint</code> of an implicit <code>CALayer</code> is the center of the parent <code>UIView</code>.
  Meaning I have to subtract or add 160 to each value I want to animate on the x-axix, or 284 (this does vary due to NavigationBars) on the y-axis.</p>
  
  <p>But I got into a situation which was kinda weird in my eyes. I'll explain it here:</p>
  
  <p>I created a bar on the bottom of the screen, which is 44px heigh. I created it with this <code>frame</code>: <code>CGRectMake(0.0, 568.0, 320.0, 44.0)</code>. <code>524</code> would be the normal position, <code>568</code> is the hidden position.
  The animation did not work with these values, neither adding or subtracting 284 solved the issue. I had to experiment a bit, to get it working, this is the working version of my code. </p>
  
  <pre><code>CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.y"];
  [animation setFromValue:[NSNumber numberWithFloat:546.0]];
  [animation setToValue:[NSNumber numberWithFloat:590.0]];
  [animation setDuration:0.3];
  [[self layer] addAnimation:animation forKey:@"inAnimation"];
  [[self layer] setPosition:CGPointMake(160.0, 590.0)];
  </code></pre>
  
  <p>This animates the <code>UIView</code> out of the visible area. Why do I have to use <code>546</code> instead of <code>524</code> for my <code>fromValue</code> and <code>590</code> for my <code>toValue</code>. This is a difference of 22px. Why?</p>
  
  <p>Still a miracle.</p>