3

I'm using a tiled layer in a scroll view to display a custom view. The contents of the custom view change periodically, and I know the rectangle in which those changes occur. However I have found that if I do a setNeedsRedisplay only one tile is getting redrawn. How can I tell the CATiledLayer to redraw only the affected tiles?

Frank E
  • 53
  • 5

1 Answers1

3

If you call setNeedsDisplay on the CATiledLayer, then it redraws all its tiles. If you use setNeedsDisplayInRect instead, it should only redraws those tiles that intersect with the rectangle you specify. Note however, that it will redraw the whole tile, not just the part that intersects with the rectangle.

Note also the redraw bug in CATiledLayer when you call setNeedsDisplay when it is in the process of drawing. More on that you can find in this question.

Community
  • 1
  • 1
fishinear
  • 6,101
  • 3
  • 36
  • 84