// 用于创建一个基础路径 + (instancetype)bezierPath; // 用于画矩阵 + (instancetype)bezierPathWithRect:(CGRect)rect; // 用于在矩形里面画出一个圆形 + (instancetype)bezierPathWithOvalInRect:(CGRect)rect; // 用于在矩形里面画出一个椭圆 + (instancetype)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius; // 可以指定画圆角,可以一个View添加圆角 + (instancetype)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii; // 根据一个点画出一条弧线/圆 + (instancetype)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; // 根据一个Core Graphics路径创建一个新的路径 + (instancetype)bezierPathWithCGPath:(CGPathRef)CGPath; // 将画笔移动到某一个点 - (void)moveToPoint:(CGPoint)point; // 从一个点添加一条线到point点 - (void)addLineToPoint:(CGPoint)point; // 从一个点添加曲线到另一个点endPoint,曲线的弯度控制点有两个controlPoint1和controlPoint2。 - (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2; // 从一个点添加曲线到另一个点endPoint,曲线的弯度控制点controlPoint - (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint; // 根据一个点画出一条弧线/圆 - (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise NS_AVAILABLE_IOS(4_0); // 合拢当前路径的起始点和终止点 - (void)closePath; // 移除path路径瞄下的所有路径,当然必须要在[path fill];或者是[path stroke];语句之前才有效果 - (void)removeAllPoints; // 路径之间的拼接,拼接之后只需要调用拼接路径的路径执行fill/stroke即可,但是fill和closePath是独立的不会互相影响 - (void)appendPath:(UIBezierPath *)bezierPath; // 反向绘制path - (UIBezierPath *)bezierPathByReversingPath ; - (void)applyTransform:(CGAffineTransform)transform; @property(readonly,getter=isEmpty) BOOL empty;// 判断路径是否为空 @property(nonatomic,readonly) CGRect bounds;// 获取当前路劲的画板CGRect @property(nonatomic,readonly) CGPoint currentPoint;// 获取当前路径下的画笔的点 - (BOOL)containsPoint:(CGPoint)point;// 判断路劲里面是否包含某个点,需要是重要点才为true,fill形成的点不算 @property(nonatomic) CGFloat lineWidth;// 线的宽度 @property(nonatomic) CGLineCap lineCapStyle;// 线的类型 @property(nonatomic) CGLineJoin lineJoinStyle;// 线尾部头部的类型 @property(nonatomic) CGFloat miterLimit; // Used when lineJoinStyle is kCGLineJoinMiter @property(nonatomic) CGFloat flatness; @property(nonatomic) BOOL usesEvenOddFillRule; // Default is NO. When YES, the even-odd fill rule is used for drawing, clipping, and hit testing. - (void)setLineDash:(nullable const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase; - (void)getLineDash:(nullable CGFloat *)pattern count:(nullable NSInteger *)count phase:(nullable CGFloat *)phase; - (void)fill;//填充颜色 - (void)stroke;//功能包括fill,并且会自动关闭上下文 // These methods do not affect the blend mode or alpha of the current graphics context - (void)fillWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)strokeWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)addClip;//添加裁剪,会将路径之外的图案切除,但是必须在路径执行fill/stroke方法之前才有效