ios学习临时笔记-UIBezierPath学习

来源:互联网 发布:1433端口打不开 编辑:程序博客网 时间:2024/06/17 05:29

一.方法介绍

+ (UIBezierPath *)bezierPath
创建一个UIBezierPath对象

+ (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise
创建一段弧线路径

+ (UIBezierPath *)bezierPathWithCGPath:(CGPathRef)CGPath
使用指定路径创建一个新的路径对象

+ (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect
根据rect是正方形还是长方形,创建一个圆形或椭圆形

+ (UIBezierPath *)bezierPathWithRect:(CGRect)rect
创建一个矩形路径

+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii
根据一个矩形(某个角带圆角)创建曲线

+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius
根据一个带圆角的矩形框创建曲线

- (void)moveToPoint:(CGPoint)point;
移动到某个点

- (void)addLineToPoint:(CGPoint)point;
移动到某个点添加直线

- (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint;
绘制贝塞尔二次曲线

- (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2;
绘制贝塞尔三次曲线

- (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise
根据弧度中心点,弧度半径,弧度开始度数,弧度结束度数,是否顺时针画弧度来进行弧线的绘制

- (void)closePath;
关闭路径

- (void)removeAllPoints;
移除所有的点

- (void)fill;
填充,用于闭合曲线内部

- (void)stroke;
画线

二.属性变量

@property(nonatomic) CGFloat lineWidth;  线条宽度



@property(nonatomic) CGLineCap lineCapStyle; 


@property(nonatomic) CGLineJoin lineJoinStyle;


@property(nonatomic) CGFloat miterLimit; 斜接限制,限制为10


@property(nonatomic) CGFloat flatness; 平直度,默认为0.6,值越大,锯齿状曲线越多



0 0