我在UITouches Moved
中使用此代码来绘制图片。
UIGraphicsBeginImageContext(myimage.frame.size);
[myimage.image drawInRect:myimage.frame];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 10);
CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [UIColor colorWithPatternImage:[UIImage imageNamed:@"coloredImage.png"]].CGColor);
CGContextSetFillColorWithColor(UIGraphicsGetCurrentContext(), [UIColor clearColor].CGColor);
CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), YES);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), previous.x, previous.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), touchLocation.x, touchLocation.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
myimage.image = UIGraphicsGetImageFromCurrentImageContext();
previous = touchLocation;
这里我需要在用户完全绘制图像时进行警告...即,我有一个图案图像为myimage
而coloredImage
是覆盖myimage
的图像当用户触摸时如何确定用户是否完成了图像绘制?