绘制一个填充的半圆

时间:2012-03-30 21:47:23

标签: ios uiview core-graphics

在UIView中绘制填充(!)半圆的最佳方法是什么?我玩了CGContextAddArc函数,但它似乎没有提供填充。这是我喜欢绘制的内容 - 两个填充的半圆圈。

enter image description here

1 个答案:

答案 0 :(得分:15)

CGContextBeginPath(gc);
CGContextAddArc(gc, 100, 100, 50, -M_PI_2, M_PI_2, 1);
CGContextClosePath(gc); // could be omitted
CGContextSetFillColorWithColor(gc, [UIColor cyanColor].CGColor);
CGContextFillPath(gc);
相关问题