私はついに、使用して常にクリアされなかったDrawRectを取得することができました(私はsetClearsContextBeforeDrawing:YESも持っています)
- (void)drawRect:(CGRect)rect
{
UIGraphicsPushContext(drawingContext);
CGImageRef cgImage = CGBitmapContextCreateImage(drawingContext);
UIImage *uiImage = [[UIImage alloc] initWithCGImage:cgImage];
CGContextSetLineWidth(drawingContext, 4.0);
if (draw)
CGContextSetStrokeColorWithColor(drawingContext, [UIColor whiteColor] CGColor]);
else
CGContextSetStrokeColorWithColor(drawingContext, [[UIColor clearColor] CGColor]);
CGContextMoveToPoint(drawingContext, lastPt.x - (31.0 / self.transform.a), lastPt.y - (31.0 / self.transform.a) );
CGContextAddLineToPoint(drawingContext, currPt.x - (31.0 / self.transform.a), currPt.y - (31.0 / self.transform.a) );
CGContextStrokePath(drawingContext);
UIGraphicsPopContext();
CGImageRelease(cgImage);
[uiImage drawInRect: rect];
lastPt = currPt;
}
これにより、描画時に線が
残ります。私の問題は、描画がNOの場合です[UIColor clearColor]は消去されません。消去には何を使用する必要がありますか?前もって感謝します