绘制圆的一部分 [英] Draw part of a circle
本文介绍了绘制圆的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于iPhone应用程序,我想画一个圆,这只是一个x百分比填充。
For an iPhone application I want to draw a circle, that is only for an x percentage filled.
这样:
我没有问题计算半径,度或弧度,这没有问题。绘制圆也已经完成了。但是如何获得iPhone SDK绘制填充的部分。
I have no problems calculating the radius, the degrees or the radians, that is no problem. Also drawing the circle is already done. But how do I get the iPhone SDK to draw the part that is filled.
我可以绘制一个大小的矩形,但不是圆的一部分。
I can draw a rectangle that size, but not part of a circle.
我只是想在一个正常的上下文中画出来。
I just want to draw that on a a normal context.
希望有人可以给我任何指针。
Hope someone can give me any pointers here.
推荐答案
使用 CGContext
的arc函数:
CGContextAddArc(context,
centerX,
centerY,
radius,
startAngleRadians,
endAngleRadians,
clockwise ? 1 : 0);
请参阅 CGContextAddArc()
。
这篇关于绘制圆的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文