1.直线
//1.获取上下文
CGContextRef ctx = UIGraphicsGetCurrentContext();
//1.1 设置线条的宽度
CGContextSetLineWidth(ctx, 66);
//1.2 设置线条的起始点样式
CGContextSetLineCap(ctx,kCGLineCapButt);
//1.3 虚实切换 ,实线5虚线10
CGFloat length[] = {3,3};
CGContextSetLineDash(ctx, 0, length, 0);
//1.4 设置颜色
[[UIColor whiteColor]set];
//2.设置路径-起点
CGContextMoveToPoint(ctx, 0, 0);
//终点
CGContextAddLineToPoint(ctx, WIDTH/2, WIDTH/2);
2.圆
//1.获取上下文
CGContextRef ctx = UIGraphicsGetCurrentContext();
//1.1 设置线条的宽度
CGContextSetLineWidth(ctx, 6);
//1.2 设置线条的起始点样式
CGContextSetLineCap(ctx,kCGLineCapButt);
//1.3 虚实切换 ,实线5虚线10
CGFloat length[] = {3,6};
CGContextSetLineDash(ctx, 0, length, 2);
//1.4 设置颜色
[[UIColor whiteColor]set];
//[[UIColor colorWithRed:255/255 green:255/255 blue:255/255 alpha:76/255] set];
//2.设置路径
CGContextAddArc(ctx, kScreenW/2 , kScreenW/2, kScreenW/2-10, -M_PI_2*3, M_PI_2, 0);
//之前版
//CGContextAddArc(ctx, 200/2 , 200/2, 80, -5*M_PI_4, M_PI_4, 0);
//3.绘制
CGContextStrokePath(ctx);
3。实线圆//绘制内部的进度条
//1.获取上下文
CGContextRef ctx1 = UIGraphicsGetCurrentContext();
//1.1 设置线条的宽度
CGContextSetLineWidth(ctx1, 2);
//1.2 设置线条的起始点样式
CGContextSetLineCap(ctx1,kCGLineCapButt);
//1.3 虚实切换 ,实线5虚线10
CGFloat length1[] = {3,3};
CGContextSetLineDash(ctx1, 0, length1, 0);
//74bf6f a2ef9d
[UIColor colorWithRed:252/255 green:212/255 blue:117/255 alpha:255/255];
//1.4 设置颜色------该颜色是进度条绘制时的颜色
[[UIColor colorWithRed:252.0/255 green:212.0/255 blue:117.0/255 alpha:1] set];
// [[UIColor greenColor]set];
//2.设置路径
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(numberChange:) name:@"number" object:nil];
CGFloat end1 = -M_PI_2*3+(2*M_PI*_num/100);
//之前版
//CGFloat end = -5*M_PI_4+(6*M_PI_4*_num/100);
//0表示顺时针
CGContextAddArc(ctx1, kScreenW/2 , kScreenW/2, kScreenW/2-20, -M_PI_2*3, end1 , 0);
//之前版
//CGContextAddArc(ctx, 200/2 , 200/2, 80, -5*M_PI_4, end , 0);
//3.绘制
CGContextStrokePath(ctx1);