UIGraphicsBeginImageContext(self.view.bounds.size);
[currentStrokeImageView.image drawInRect:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeNormal);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), dWidth);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), r, g, b, 1.0f);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), pointA.x, pointA.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), pointB.x, pointB.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
currentStrokeImageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
出于某种原因,这在 iphone/ipod 上运行绝对没有滞后,但在 iPad 上,它们在绘图时有很大的滞后。我使用的代码在上面,有什么建议可以解决这个问题吗?