I have this UIView that I subclassed and implemented my own drawRect method.
When the drawRect method runs the first time, I grab the context in a variable using
ctx = UIGraphicsGetCurrentContext();
later on the code, outside drawRect, I am trying to clean the whole context filling it with a transparent color, then I do:
CGContextClearRect(ctx, self.bounds);
[self setNeedsDisplay];
The problem is that the context is not erased and continues as before.
At this point ctx is not nil.
am I missing something?
thanks
Is it not possible to move the clearing into drawRect? I’m not sure if drawing out side of drawRect is possible, and even if it is, it’s not exactly how it’s intended to work.