I'm making a complex drawing using quartz based on passed in information. The only part I haven't been able to figure out is how do I clear the lines, rectangles, etc th开发者_运维问答at I've already drawn? Basically, I want to erase the whole drawing and just draw it again from the new data.
If you set your UIView
's clearContextBeforeDrawing
property to YES
, then the system should take care of filling its area with its backgroundColor
before calling its drawRect:
method.
If you want to clear something that's not tracked as part of the current state, it's probably less expensive to just release your old context and start a new one.
精彩评论