- (void)drawRect:(CGRect)rect方法:
{
CGContextRef ctx = UIGraphicsGetCurrentContext();//1.0獲取上下文
CGContextSetLineWidth(ctx, 25);//1.1 設(shè)置線條的寬度
CGContextSetLineCap(ctx,kCGLineCapButt);//1.2 設(shè)置線條的起始點(diǎn)樣式
CGFloat length[] = {3,8};//1.3 虛實(shí)切換
CGContextSetLineDash(ctx, 0, length, 1);
[[UIColor grayColor] set];//1.4 設(shè)置顏色
CGContextAddArc(ctx, MAIN_WIDTH/2 , MAIN_WIDTH/2, 100, -M_PI_2, - M_PI_2 + (M_PI * 2)*80/100, 0);//2.設(shè)置路徑
CGContextStrokePath(ctx);//3.繪制
}