5

I'm trying to draw a quarter circle in iOS. In Mac OS, it seems you can use appendBezierPathWithArcWithCenter but this doesn't seem to work in iOS.

Does anyone know how to simply draw a quarter circle in iOS?

Thanks

beev
  • 1,197
  • 2
  • 16
  • 33
  • Think I've found the answer... bezierPathWithArcCenter:radius:startAngle:endAngle:clockwise: – beev Jul 27 '11 at 17:20

1 Answers1

4

There are two iOS equivalents, one for UIBezierPath and one for CGPath:

UIBezierPath equivalent

UIBezierPath *path = [UIBezierPath bezierPath];
[path addArcWithCenter:centerPoint
                radius:radius
            startAngle:startAngle
              endAngle:endAngle
             clockwise:YES];

CGPath equivalent

CGMutablePathRef path = CGPathCreateMutable();
CGPathAddArc(path, NULL,
             centerPoint.x, centerPoint.y,
             radius,   
             startAngle,  
             endAngle,   
             NO); // clockwise
David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205
  • 1
    Remember that you'll need to covert your NSBezierPath angles (in degrees) to radians for UIBezierPath angles. (degreeAngle*(PI/180)) – MOK9 Nov 09 '14 at 23:44