Please see this simple CATiledLayer example https://github.com/seanhess/CATiledLayer-Example
It consists of one viewController with a hierarchy like this:
view: (frame = window size)
scrollView: (frame = window size, content size = 200 x 4000)
contentView: (frame = content size = 200 x 4000, tile size = 100 x 100)
The content view's layer has been overriden to be a CATiledLayer.
If you run the linked code, you'll see that tiles with the same rect are requested multiple times. It happens both when you first run the code, and when you scroll.
Switch to branch "one-column" - it only happens on init, never when you scroll down.
Switch to branch "default-tile-size" - it only happens on init, but very rarely (you have to run it multiple times before it happens)
I'm trying to write some code in drawLayer:inContext:
that locates the correct data and draws it. It could be expensive, and I don't want to do it more than once.
Any idea what is going on? What could I do differently?
In the end, the answers didn't work. It is fairly simple, though, to make your delegate method be aware of whether or not it has drawn that cycle.