The problem is that you are using a square brush, and you just erase that square at one point in the line that the user drew. Also, the color of your stroke is completely wrong for what you are trying to do.
It looks like you are trying to set the stroke to a clear color and draw a line between the previous and current points. If you want to do this, you must do this:
CGContextRef currCtx = UIGraphicsGetCurrentContext(); CGContextSetRGBStrokeColor (currCtx, 0, 0, 0, 0); CGContextMoveToPoint (currCtx, startPt.x, startPt.y); CGContextLineToPoint (currCtx, endPt.x, endPt.y);
In this case, startPt.x / y is the location of the previous touch, and endPt.x / y is the current touch.
Please note that in order for the lines to be as good as in the picture you posted, you will need to use an antialized texture and draw it at each point along the line, changing its size. But the above should give you something workable that looks pretty good.
source share