iPhone - cleaning the context of a UIView outside drawRect
<p>I have this UIView that I subclassed and implemented my own drawRect method.</p>

<p>When the drawRect method runs the first time, I grab the context in a variable using </p>

<pre><code>ctx = UIGraphicsGetCurrentContext();
</code></pre>

<p>later on the code, outside drawRect, I am trying to clean the whole context filling it with a transparent color, then I do: </p>

<pre><code>CGContextClearRect(ctx, self.bounds);
[self setNeedsDisplay];
</code></pre>

<p>The problem is that the context is not erased and continues as before.</p>

<p>At this point ctx is not nil.</p>

<p>am I missing something?</p>

<p>thanks</p>
