title: pull to refresh animation like mail in iOS6
body: <p>I am an iOS developer and recently i got installed the newest iOS 6 on testing. As i came across with mail pull to refresh animation, i decided to try to implement it on my own. I have tried to use CAShapeLayer with UIBezierPath to create the same oval shape that can be dragged forward down. And in order to get the down part stretched downwards i have tried to use adding curve with two control points and applied CABasicAnimation. But unfortunately the result is not as i expected. Since the stretched lines get a little oval inside. I suppose the oval animation has to do something with other classes. I would be very appreciative if someone could lead me to some ideas here.
  Thanks a lot</p>
  
  <pre><code>- (UIBezierPath *)createCircleForRect:(CGRect)bRect
  {
      UIBezierPath *circle = [UIBezierPath bezierPath];
  
      CGFloat rectWidth = bRect.size.width;
      CGFloat rectHeight = bRect.size.height;
  
      minSize = MIN(rectWidth, rectHeight);
  
      //center = CGPointMake(minSize/2.0f, minSize/2.0f);
  
      CGFloat radius = minSize/2.0f - 5.0f;
      startPointOffset = center.x - radius;
  
      if(startPointOffset == 5.0f)
          testVal = 0;
      else 
          testVal += startPointOffset;
  
      NSLog(@"startPointOffset =&gt;&gt; %f", startPointOffset);
      NSLog(@"radius =&gt;&gt; %f", radius);
  
      NSLog(@"after center =&gt;&gt; %f, %f", center.x, center.y);
  
      [circle addArcWithCenter:center radius:radius startAngle:DEGREES_TO_RADIANS(0) endAngle:DEGREES_TO_RADIANS(180) clockwise:NO];
  
      [circle moveToPoint:CGPointMake(startPointOffset, center.y)];
  
      [circle addCurveToPoint:CGPointMake(center.x + radius, center.y) controlPoint1:CGPointMake(center.x - radius, rectHeight + 10.0f) controlPoint2:CGPointMake(center.x + radius, rectHeight + 10.0f)];
  
      [circle closePath];
      return circle;
  }
  
  -(void)startAnimation
  {   
      CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"];
  
      animation.duration = 1.0;
  
      animation.repeatCount = HUGE_VALF;
  
      animation.autoreverses = YES;
  
      animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
  
      animation.fromValue = (id)roundBPath;
  
      CGRect smallerRect = self.frame;
  
      smallerRect.size.height += 50;
      smallerRect.size.width -= 80;
  
  
      UIBezierPath *newRound = [self createCircleForRect:smallerRect];
  
  
      animation.toValue = (id)(newRound.CGPath);
  
  
      [shapeLayer addAnimation:animation forKey:@"animatePath"];
  }
  </code></pre>