title: Rotating a CAShapeLayer arc about its center using CABasicAnimation
body: <p>I have an arc that I have drawn using CAShapeLayer and I want it to rotate around the circle's center. I am trying to get this animation using a CABasicAnimation on the 'transform.rotation' property. But the rotation seems is happening about a point that is not the same as the circle's center. </p>
  
  <pre><code>-(void)drawRect:(CGRect)rect{
   int radius = 100;
   CAShapeLayer *circle = [CAShapeLayer layer];
   circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius) cornerRadius:radius].CGPath;
   circle.fillColor = [UIColor orangeColor].CGColor;
   circle.strokeColor = [UIColor blueColor].CGColor;
   circle.lineWidth = 5;
   circle.strokeStart = 0.0f;
   circle.strokeEnd = 0.1f;
   [self.layer addSublayer:circle];
  
   CABasicAnimation *spinAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
   spinAnimation.byValue = [NSNumber numberWithFloat:2.0f*M_PI];
   spinAnimation.duration = 4;
   spinAnimation.repeatCount = INFINITY;
   [circle addAnimation:spinAnimation forKey:@"indeterminateAnimation"];
  } 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/BxQPq.png" alt="enter image description here"></p>
  
  <p>I know its an old problem, but whats the way out. I have tinkered a lot by setting the layer's bounds or the anchor point but it doesn't rotate about the center yet.</p>
  
  <pre><code>circle.bounds = self.frame;
  </code></pre>
  
  <p>Here is how I add the view to the view controller.</p>
  
  <pre><code>[self.view addSubview:[[ProgressIndicator alloc] initWithFrame:CGRectMake(50, 50, 200, 200)]];
  </code></pre>