我的问题可能会在某个地方得到解答,但经过长时间的研究,我找不到解决办法 .

我需要在iPhone上绘制视觉形状(曲线,线条,矩形等) . 我使用 CGContext 来绘制图像并使用's working fine. However in my app the drawing view resizes on device rotation and the lines become blurred because of the different image size. That'为什么我将 UIView 子类化并从 touchesMovedtouchesEnded 调用 setNeedsDisplay . 在 drawRect 我正在传递这一点......几乎一切正常 . 但是我有两个问题:1 . 每次调用 drawRect 时它都会清除上一个绘图并重新开始,所以我可以按照每次移动的方式制作一条曲线 drawRect 并且前一个点被解除并且从起点添加一条线到现在 .

所以我做错了,还有其他一些更好的方法 .

提前致谢!