Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an iOS equivalent of appendBezierPathWithArcWithCenter

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

like image 605
beev Avatar asked Oct 11 '22 12:10

beev


1 Answers

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
like image 155
David Rönnqvist Avatar answered Oct 13 '22 02:10

David Rönnqvist