0
我想在两点之间画线。这是我的代码。但上下文记忆是0在两个不同点之间画线
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
CGFloat components[] = {0.0, 0.0, 1.0, 1.0};
CGColorRef color = CGColorCreate(colorspace, components);
CGContextSetStrokeColorWithColor(context, color);
CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, 300, 400);
CGContextStrokePath(context);
CGColorSpaceRelease(colorspace);
CGColorRelease(color);
你在用什么方法试试这个?。, – Vignesh 2012-04-12 10:45:18
什么上下文内存?你确定你的'context'变量不是'nil'吗? – Alexander 2012-04-12 10:46:35
可能重复:http://stackoverflow.com/questions/1878821/how-to-draw-line-between-two-points – Devang 2012-04-12 10:48:58