xcode 用笔划和填充颜色绘制圆圈

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3262582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:32:47  来源:igfitidea点击:

Drawing circle with stroke and fill color

iphoneobjective-cxcode

提问by Allen

how to draw a circle using CGContextAddArc with different sroke color and fill color?

如何使用具有不同笔触颜色和填充颜色的 CGContextAddArc 绘制圆?

回答by Piotr Kalinowski

Wouldn't something like this work?

不会像这样的工作吗?

CGContextAddArc(ctx, x, y, 1.0, 0, 2 * Pi, 1); // Or is it 2 * M_PI?

CGContextSetFillColorWithColor(ctx, fillColor);
CGContextSetStrokeColorWithColor(ctx, strokeColor);
CGContextDrawPath(ctx, kCGPathFillStroke);