-(void) DrawRect: (cgrect) rect
{
CGRect bounds = self.bounds;//based on bounds center point
Cgpoint Center; Center of the centering screen of the center
center.x = bounds.origin.x + bounds.size.width/2.0; Calculate the span of the screen separately, and compare it, since the drawn circle should not exceed the bounds of the screen, with the shorter half as the radius
CENTER.Y = Bounds.origin.y + bounds.size.height/2.0;
float radius = (MIN (bounds.size.height, Bounds.size.width)/2.0);
Uibezierpath *path = [[Uibezierpath alloc]init];//uses the Uibezierpath class to draw the circle, related usage can consult the API documentation, you can remember
[Path Addarcwithcenter:center Radius:radius startangle:0.0 ENDANGLE:M_PI * 2.0 clockwise:yes];//Center point, radius radius, Defines a 0-M_PI * 2.0 radian Path, which is the full circle, clockwise to select Yes or no, because the whole circle is irrelevant
Set the line width to 10
Path.linewidth = 10;
Set Drawing color
[[Uicolor Lightgraycolor] setstroke];
Draw Path
[Path stroke];
}
I am very sorry that I have not typed in the document, because you will encounter problems, after the call, continue to update
function methods for drawing circles in iOS