#import "ViewController.h"
#define pi 3.14159265359
#define DEGREES_TO_RADIANS(degrees) ((pi * degrees)/ 180)
@interface ViewController ()
@property(nonatomic, strong) CAShapeLayer *shapeLayer;
@end
self.shapeLayer = [CAShapeLayer layer];
_shapeLayer.frame = CGRectMake(0, 0, 200, 200);
_shapeLayer.position = self.view.center;
_shapeLayer.fillColor = [UIColor clearColor].CGColor;
_shapeLayer.lineWidth = 1.0f;
_shapeLayer.strokeColor = [UIColor redColor].CGColor;
// UIBezierPath *circlePath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 200, 200)];
// UIBezierPath *circlePath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 200, 200)];
// UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(150, 150)
// radius:75
// startAngle:0
// endAngle:DEGREES_TO_RADIANS(135)
// clockwise:YES];
// //绘制二次贝塞尔曲线
// UIBezierPath *circlePath = [UIBezierPath bezierPath];
[circlePath moveToPoint:CGPointMake(20, 100)];
// [circlePath moveToPoint:CGPointMake(0, 100)];
// [circlePath addQuadCurveToPoint:CGPointMake(200, 100) controlPoint:CGPointMake(100, 0)];
//绘制三次贝塞尔曲线
//绘制二次贝塞尔曲线
UIBezierPath *circlePath = [UIBezierPath bezierPath];
// // [circlePath moveToPoint:CGPointMake(20, 100)];
// [circlePath moveToPoint:CGPointMake(0, 100)];
// [circlePath addQuadCurveToPoint:CGPointMake(200, 100) controlPoint:CGPointMake(100, 0)];
[circlePath moveToPoint:CGPointMake(20, 50)];
[circlePath addCurveToPoint:CGPointMake(200, 50) controlPoint1:CGPointMake(110, 0) controlPoint2:CGPointMake(110, 100)];
_shapeLayer.path = circlePath.CGPath;
_shapeLayer.strokeStart = 0;
_shapeLayer.strokeEnd = 1.0;
[self.view.layer addSublayer:_shapeLayer];