2

I'm drawing images in a grid formation. Some of the images will move, and I need to update the display, but obviously, I don't want to refresh the whole screen unnecessarily. I am using SetNeedsDisplayInRect multiple times but sometimes, it seems (and I'm getting this from other sources) UIKit will invalidate extra rects. I don't mind redrawing these extra blocks, but I need to know what extra blocks are being invalidated.

I'm currently keeping an array of the rects I need to refresh, but when the system does extra ones, I wind up with empty squares because I didn't expect to redraw them.

DrawRect has the parameter, but it is a single rectangle which encompasses the invalided areas. Is there a way to determine these extra rectangles?

Nelson Ko
  • 247
  • 4
  • 11
  • That's an interesting question. Where are you keepin track of the invalidated rects? Could you just override setNeedsDisplayInRect on the view and track it there, or does it appear that the system is invalidating rects outside that mechanism? – jrturton Feb 10 '13 at 13:44
  • I have arrays keeping track of the moving images, so if I just redraw these items (and the empty squares they leave), I fill most of the invalidated items. Every now and then, tho, extra invalidated areas (usually in between the areas I have recorded to in the form of a square or rectangle) will show up. Since I didn't instigate those areas, I have not recorded them or redrawn them, and they show up blank. – Nelson Ko Feb 11 '13 at 04:29
  • It has been a while since your question. I'd like to know what solution you (or anyone) adopted. Thanks! – Rudolf Real Mar 19 '18 at 14:08

0 Answers0