I would like to draw a straight line between where a user touches the screen, and where the touch ends. i need multiple lines, for if the user repeats the touch-drag-release act
The Problem is that UIGraphicsGetCurrentContext()
will return a null-reference.
If you want to draw into an UIImage you can get the CGContextRef as follows:
UIGraphicsBeginImageContext(anUIImage);
now calling UIGraphicsGetCurrentContext()
will not longer return a null-reference.
... drawing goes here
UIImage* drawnImage = UIGraphicsGetImageFromCurrentImageContext();
// display the image on an view
UIGraphicsEndImageContext();