views:

862

answers:

1

On the iPhone (though I imagine it's an equally valid question in Cocoa) I have a UIScrollView around a UIView backed by a CATiledLayer. The way it works by default is to load any uncached/unfetched tiles when my viewport scrolls over a blank section of the CATiledLayer.

What I would like to know is if there's a way to trigger CATiledLayer to load a tile that's not actively being displayed? I would like to, for example, preload all tiles contiguous to the currently displayed tile while they are still offscreen, thus avoiding flashing a blank screen that fades in to the image once it's loaded asynchronously.

Any ideas?

A: 

You should try calling setNeedsDisplayInRect: on the areas you wish to display. If you want to keep within tile boundaries you can use the tileSize property to compute tile boundaries.

But I do not know for sure if this will work and we do not know how the tile caching mechanism works.

Jon Steinmetz