How to avoid background erasing when drawing lines?
I'm writing a paint app.
When drawing a line in CGContext, the background with the size of the bounding box of the line is alwa开发者_如何学运维ys got erased - the underlying lines in that box will be cleared.
How to avoid the background erasing?
[EDIT] Better: see How to draw a line on top of an image when finger moves on iPhone. If your image is added as a background specifically, not directly to the view, it will do what you're looking for.
[original] Keep everything you've drawn already, and redraw it in every call to drawRect
via setNeedsDisplay
.
Or, set your UIView
containing the line to UIColor clearColor
.
精彩评论