You set dashPhase = 0. so every time you start a new line, the template starts with a segment with a schedule of 30 units, followed by a 30-segment unpainted segment. If the line segments are short, the entire line will be colored.
Thus, either you use one path where you add only line segments, or calculate for each new dashPhase subdirectory where to start the template.
(Should the last parameter CGContextSetLineDash be the length of dashLengths[] , i.e. 2 ?)
UPDATE:. As we found out in the discussion, the solution to the problem really was to add line segments to the last bezier path while the user draws the same curve:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
source share