1

我正在使用此代码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并且coloredImagemyimage在用户触摸时绘制的图像。我怎样才能知道用户是否完成了图像的绘制?

4

0 回答 0