开发者

How to erase Drawing Lines on UIView

I drew a line on UIView. It's working properly. I did the same thing as described here : [question]:http://stackoverflow.co开发者_如何学Pythonm/questions/2595446/drawing-an-image-is-completely-out

And now I need to erase those lines. Erase means after I move my finger on the touch screen I need to erase it. Just like an eraser. How can I do it?


If you are asking to erase the whole line when the user touches it, than i don't know how you can achieve that, but if you are asking to erase the part of the line were the user touches, than you can draw a line of the color the view that you are using to draw the line on to in that way you will get the effect of an eraser.


You have to call setNeedsDisplayInRect: (UIView) to set the rectangle of the line as invalid. Only this rectangle will be redrawn until the next drawing cycle.

Make sure you have a flag in the drawRect: method you can ask for, that identifies whether the line should be drawn or not.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜