- (void)viewDidLoad {
[superviewDidLoad];
//首先得到路径两种方法
//曲线1--画曲线方法1⃣️
CGMutablePathRef path =CGPathCreateMutable();
CGPathMoveToPoint(path,nil,0,0);
CGPathAddCurveToPoint(path,nil,0,0,200,100,0,400);
//曲线2--用贝塞尔画曲线路径方法2⃣️
//创建出圆形贝塞尔曲线
UIBezierPath *circlePath = [UIBezierPathbezierPathWithOvalInRect:CGRectMake(0,0,200,200)];
//根据路径画图工具
//创建出CAShapeLayer
self.shapeLayer = [CAShapeLayerlayer];
//填充颜色为ClearColor
self.shapeLayer.fillColor = [UIColorclearColor].CGColor;
//设置线条的宽度和颜色
self.shapeLayer.lineWidth =1.0f;
self.shapeLayer.strokeColor = [UIColorredColor].CGColor;
//将路径添加到画图工具中
//让贝塞尔曲线与CAShapeLayer产生联系
self.shapeLayer.path =path;
//添加并显示
[self.view.layeraddSublayer:self.shapeLayer];
}