Quartz2D绘图的代码步骤
CGContextRef ctx= UIGraphicsGetCurrentContext();
CGContextMoveToPoint(ctx,10, 10);
CGContextAddLineToPoint(ctx,100, 100);
CGContextStrokePath(ctx);//CGContextFillPath(ctx);
常用拼接路径函数
voidCGContextMoveToPoint(CGContextRef c, CGFloat x, CGFloaty)
voidCGContextAddLineToPoint(CGContextRefc, CGFloatx, CGFloaty)
voidCGContextAddRect(CGContextRefc, CGRect rect)
voidCGContextAddEllipseInRect(CGContextRefcontext, CGRect rect)
voidCGContextAddArc(CGContextRefc, CGFloatx, CGFloaty,
CGFloatradius, CGFloatstartAngle, CGFloatendAngle, intclockwise)
voidCGContextDrawPath(CGContextRefc, CGPathDrawingMode mode)
voidCGContextStrokePath(CGContextRefc)
voidCGContextFillPath(CGContextRefc)
提示:一般以CGContextDraw、CGContextStroke、CGContextFill开头的函数,都是用来绘制路径的
图形上下文栈的操作
voidCGContextSaveGState(CGContextRef c)
voidCGContextRestoreGState(CGContextRef c)