title: how to position a rotating CAShapeLayer at certain point in UIImageView?
body: <p>I have the following code which makes an oval rotating around its center. I would like to be able to position it within <code>UIImageView</code> at a certain position (say a middle of the view). </p>
  
  <p>I would really appreciate if someone could help me out on this one.</p>
  
  <pre><code>-(void)drawCircle
  {
  CGMutablePathRef circlePath = CGPathCreateMutable();
  int radius = 400;
  CGRect circleRect = CGRectMake(CENTER_Y-radius*0.7, CENTER_X-radius, 1.4*radius, 2*radius);
  float midX = CGRectGetMidX(circleRect);
  float midY = CGRectGetMidY(circleRect);
  
  CGAffineTransform transform = CGAffineTransformMakeTranslation(-midX, -midY);
  CGPathAddEllipseInRect( circlePath ,&amp;transform , circleRect);
  
  CAShapeLayer *circle = [[CAShapeLayer alloc] init];
  circle.path = circlePath;
  circle.opacity = 0.1;
  circle.contentsScale = SCREEN_SCALE;
  circle.fillColor = [UIColor blueColor].CGColor;
  
  [aView.layer addSublayer:circle];
  CABasicAnimation* theAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
  theAnimation.fromValue = 0;
  theAnimation.toValue = @(2*M_PI);
  theAnimation.duration=3.5;
  theAnimation.autoreverses=FALSE;
  theAnimation.repeatCount=HUGE_VALF;
  theAnimation.fillMode = kCAFillModeBoth;
  theAnimation.removedOnCompletion=FALSE;
  theAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
  [circle addAnimation:theAnimation forKey:@"transform.rotation.z"];
  
  }
  </code></pre>