Cheng Guo
Cheng Guo

Reputation: 55

how to erase the lines i drew on a UIView

I create a UIView and put it on top of an imageView,and set the uiview's background color as clearcolor,all the drawing take place on that UIView,how can just erase the line I drew on that uiview ? thanks.

Upvotes: 2

Views: 717

Answers (2)

Daij-Djan
Daij-Djan

Reputation: 50129

call setNeedsDisplay on your view and next time drawRect dont draw the lines but just fill the whole bounds with clearColor

Upvotes: 0

Rad'Val
Rad'Val

Reputation: 9251

Did you try CGContextSetBlendMode(context, kCGBlendModeClear) and then draw the area you want to erase. Clearing the context with CGContextClearRect can be used too if you want to clear the whole screen (or a rectangular part of it).

Upvotes: 2

Related Questions