Я хочу нарисовать линию между двумя точками. Вот мой код. но контекст памяти 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
Какая контекстная память? Вы уверены, что ваша переменная 'context' не' nil'? – Alexander
Возможный дубликат: http://stackoverflow.com/questions/1878821/how-to-draw-line-between-two-points – Devang