UIBezierPath和CGContext类中的方法
CGContextSetLineWidth
(ctr,
10
);
// 即描写边线又填充
CGContextDrawPath (ctr, kCGPathFillStroke );
CGContextDrawPath (ctr, kCGPathFillStroke );
UIBezierPath和
CGContext
类中的方法
void
CGContextSetLineWidth(CGContextRef c, CGFloat width);
// 设置边线的宽度
void
CGContextAddLineToPoint(CGContextRef c, CGFloat x, CGFloat y); // 添加一条线到某一个点
void
CGContextSetLineCap(CGContextRef c, CGLineCap cap);
//
设置线段头尾部的样式
void
CGContextSetLineJoin(CGContextRef c, CGLineJoin join);
//
设置线段转折点的样式
void
CGContextSetRGBStrokeColor(CGContextRef context, CGFloat red,
CGFloat green, CGFloat blue, CGFloat alpha); // 设置颜色
CGFloat green, CGFloat blue, CGFloat alpha); // 设置颜色
+ (
UIBezierPath
*)bezierPath; // 创建
UIBezierPath
+ ( UIBezierPath *)bezierPathWithRect:( CGRect )rect; // 创建一个四边形
void
CGContextAddRect(CGContextRef c, CGRect rect)
+ ( UIBezierPath *)bezierPathWithOvalInRect:( CGRect )rect; // 创建一个圆形
void
CGContextAddEllipseInRect(CGContextRef context, CGRect rect)
+ ( UIBezierPath *)bezierPathWithRoundedRect:( CGRect )rect cornerRadius:( CGFloat )cornerRadius; // 创建弧形
void
CGContextAddArc(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 )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)