1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| // 画贝塞尔曲线 - (void)drawBezierArc { UIBezierPath *path = [UIBezierPath bezierPath]; path.lineWidth = 2.0; path.lineJoinStyle = kCGLineCapRound; path.lineCapStyle = kCGLineCapRound; // 曲线1 /* // 设置起始点 [path moveToPoint:CGPointMake(100, 300)]; // 设置结束点和控制点 [path addQuadCurveToPoint:CGPointMake(300, 300) controlPoint:CGPointMake(100, 50)]; */ // 曲线2 // [path moveToPoint:CGPointMake(10, 100)]; // [path addQuadCurveToPoint:CGPointMake(310, 100) controlPoint:CGPointMake(150, -90)]; // 曲线3 三次贝塞尔曲线 [path moveToPoint:CGPointMake(10, 100)]; [path addCurveToPoint:CGPointMake(310, 100) controlPoint1:CGPointMake(100, -100) controlPoint2:CGPointMake(100, 400)]; [path stroke]; }
|