UIBezierPath和CGContext类中的方法

来源:互联网 发布:牛魔王 知乎 编辑:程序博客网 时间:2024/06/08 19:50
 UIBezierPath和CGContext类中的方法

    CGContextSetLineWidth(ctr,10);
     // 即描写边线又填充
   
CGContextDrawPath(ctr,kCGPathFillStroke);


UIBezierPath和CGContext类中的方法

voidCGContextSetLineWidth(CGContextRef c, CGFloat width); // 设置边线的宽度
voidCGContextAddLineToPoint(CGContextRef c, CGFloat x, CGFloat y); // 添加一条线到某一个点
voidCGContextSetLineCap(CGContextRef c, CGLineCap cap);  //设置线段头尾部的样式
voidCGContextSetLineJoin(CGContextRef c, CGLineJoin join); //设置线段转折点的样式
voidCGContextSetRGBStrokeColor(CGContextRef context, CGFloat red,
  CGFloat green, CGFloat blue, CGFloat alpha); 
//设置颜色

+ (UIBezierPath*)bezierPath; // 创建UIBezierPath

+ (
UIBezierPath*)bezierPathWithRect:(CGRect)rect; // 创建一个四边形
voidCGContextAddRect(CGContextRef c, CGRect rect) 

+ (
UIBezierPath*)bezierPathWithOvalInRect:(CGRect)rect; // 创建一个圆形
voidCGContextAddEllipseInRect(CGContextRef context, CGRect rect)

+ (
UIBezierPath*)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius;// 创建弧形
voidCGContextAddArc(CGContextRef c, CGFloat x, CGFloat y, CGFloat radius, CGFloat startAngle, CGFloat endAngle,int clockwise)

+ (
UIBezierPath*)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii; // 创建怪异的四边形
+ (
UIBezierPath*)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; // 创建弧形,可以按照顺时针或者逆时针
+ (
UIBezierPath*)bezierPathWithCGPath:(CGPathRef)CGPath;

- (void)moveToPoint:(CGPoint)point; // 设置起点
- (
void)addLineToPoint:(CGPoint)point; // 添加一条线到某个点
- (
void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise ; // 添加一个弧形,可以按照顺时针或者逆时针

- (
void)closePath; // 关闭路径(连接起点和最后一个点)
void CGContextClosePath(CGContextRef c)
0 1
原创粉丝点击