方法一
在当前的控制器中直接加入下面代码
CAShapeLayer *layer = [CAShapeLayer new];
layer.lineWidth = 10;
//圆环的颜色
layer.strokeColor = [UIColor redColor].CGColor;
//背景填充色
layer.fillColor = [UIColor clearColor].CGColor;
//设置半径为100
CGFloat radius = 100;
//按照顺时针方向
BOOL clockWise = true;
//初始化一个路径
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:self.view.center radius:radius startAngle:(0) endAngle:M_PI*2 clockwise:clockWise];
layer.path = [path CGPath];
[self.view.layer addSublayer:layer];
这个上面的方法中创建UIBezierPath有几个参数需要注意下
UIBezierPath * path = [UIBezierPath bezierPathWithArcCenter: radius: startAngle: endAngle: clockwise:];
第一个ArcCenter弧度的中心,其类型是CGPoint
radius弧度的半径
startAngle开始角度
endAngle结束角度
clockwise是否顺时针
NOTE:贝塞尔曲线只是