Ich möchte eine Linie zwischen zwei Punkten zeichnen. Hier ist mein Code. aber Kontextspeicher ist 0.Zeichnen Sie die Linie zwischen zwei verschiedenen Punkten
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);
In welcher Methode versuchen Sie dies??., – Vignesh
Was Kontextspeicher? Sind Sie sicher, dass Ihre 'Kontext'-Variable nicht' nil 'ist? – Alexander
Mögliche Duplikate: http://stackoverflow.com/questions/1878821/how-to-draw-line-between-two-points – Devang