开发者

How to avoid background erasing when drawing lines?

开发者 https://www.devze.com 2023-01-07 13:25 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消