是否有等效于 appendBezierPathWithArcWithCenter 的 iOS

bee*_*eev 5 bezier core-graphics ios nsbezierpath

我正在尝试在 iOS 中绘制四分之一圆。在 Mac OS 中,您似乎可以使用 appendBezierPathWithArcWithCenter 但这似乎不适用于 iOS。

有谁知道如何在 iOS 中简单地绘制四分之一圆?

谢谢

Dav*_*ist 4

有两种 iOS 等效项,一种用于UIBezierPath,另一种用于CGPath:

UIBezierPath相等的

UIBezierPath *path = [UIBezierPath bezierPath];
[path addArcWithCenter:centerPoint
                radius:radius
            startAngle:startAngle
              endAngle:endAngle
             clockwise:YES];
Run Code Online (Sandbox Code Playgroud)

CGPath相等的

CGMutablePathRef path = CGPathCreateMutable();
CGPathAddArc(path, NULL,
             centerPoint.x, centerPoint.y,
             radius,   
             startAngle,  
             endAngle,   
             NO); // clockwise
Run Code Online (Sandbox Code Playgroud)