如何用不同的颜色填充我的圈子(CGContextAddArc)? [英] How to fill my circle(CGContextAddArc) with a different color?
本文介绍了如何用不同的颜色填充我的圈子(CGContextAddArc)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下,但它只绘制一个圆的边框。
我想填写圈子。
I have the following but it only draws the border of a circle. I would like to fill the circle. ??
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextAddArc(context, 50, 50, 50, 0, 30, 0);
//set the fill or stroke color
CGContextSetRGBFillColor(context, 1, 0.5, 0.5, 1.0);
CGContextSetRGBStrokeColor(context, 0.5, 1, 0.5, 1.0);
//fill or draw the path
CGContextDrawPath(context, kCGPathStroke);
CGContextDrawPath(context, kCGPathFill);
推荐答案
您需要使用 CGContextFillPath 填充路径。
这篇关于如何用不同的颜色填充我的圈子(CGContextAddArc)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文