The implementation of the answer given by @omz could be:
(assuming imgBlank is a UIImageView placed on top of the main viewcontroller)
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self.imgBlank]; NSValue *valCurrPoint=[NSValue valueWithCGPoint:CGPointMake(currentPoint.x, currentPoint.y)]; [self.dots addObject:valCurrPoint]; [self performSelector:@selector(draw:) withObject:valCurrPoint afterDelay:0]; } -(void)draw:(NSValue*)pointz{ CGPoint point=[pointz CGPointValue]; UIGraphicsBeginImageContextWithOptions(self.imgBlank.frame.size,NO,0); [self.imgBlank.image drawInRect:CGRectMake(0, 0, self.imgBlank.frame.size.width, self.imgBlank.frame.size.height)]; CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); CGContextSetLineWidth(UIGraphicsGetCurrentContext(),tickness);
Mat
source share