在一个CGPoint和另一个CGPoint之间画一条线

时间:2009-12-31 06:47:24

标签: iphone core-graphics

我有2个CGPoints,并希望在它们之间绘制直线,我该怎么做?

1 个答案:

答案 0 :(得分:6)

CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(ctx, point1.x, point1.y);
CGContextAddLineToPoint(ctx, point2.x, point2.y);
CGContextStrokePath(ctx);
相关问题