画圆的一部分 [英] Draw part of a circle

查看:62
本文介绍了画圆的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 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的弧函数:

CGContextAddArc(context,
                centerX,
                centerY,
                radius,
                startAngleRadians,
                endAngleRadians,
                clockwise ? 1 : 0);     

请参阅文档 CGContextAddArc().

See the documentation for CGContextAddArc().

这篇关于画圆的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆