Реализация ответа дается @omz может быть:
(при условии imgBlank
является UIImageView
помещается в верхней части основного зрения 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);//set the tickness here
CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeClear);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0f, 1.0f, 1.0f, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), YES);
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), _lastPoint.x, _lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), point.x, point.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
self.imgBlank.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
_lastPoint = point;
}
Пожалуйста, смотрите эту ссылку http://stackoverflow.com/questions/3863931/want-to-add-manual-erasing-option-in-ipad-painting -application-by-quartz/12797513 # 12797513 –