Say, for an iOS app, if a user slides his finger on the screen, and then 50,000 dots are recorded. If the drawing is done for all these dots in drawRect
, then next time the user touched the 50,001st dot, at the end of touchesMoved
the following line
[self.view setNeedsDisplay];
will cause drawRect
to run again and have all 50,001 dots drawn again. So for every 1 new dot (for any new movement of finger), all 50,001 dots will need to be redrawn and it is not an efficient method.
I tried just drawing the last dot in drawRect
, and it will not "add to" the existing view, but "wipe everything out" and then draw one dot.
Is there a way to
1) draw that 1 extra dot without needing to have drawRect
called?
2) or, can drawRect
draw one extra dot without first wiping the whole screen out?