Drawing incrementally in a UIView (iPhone)
问题 As far as I have understood so far, every time I draw something in the drawRect: of a UIView, the whole context is erased and then redrawn. So I have to do something like this to draw a series of dots: Method A: drawing everything on every call - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextDrawImage(context, self.bounds, maskRef); //draw the mask CGContextClipToMask(context, self.bounds, maskRef); //respect alpha mask CGContextSetBlendMode