I have a UIScrollView with a single subview, a UIView backed by a CATiledLayer. All is working well with one exception: when I change images from one to another the CATiledLayer caches the previous images zoom levels. Scrolling around then displays the old image for a split second before the updated image loads.
Is there any way to totally clear out the CATiledLayer's cache so it doesn't show old images? The CATiledLayer obviously knows that the backing image changed because it asks it's delegate for new tiles...
I think you are making this a little more complicated than it needs to be. I believe all you have to do is set the contents of your CATiledLayer to nil.
myCATiledlayer.contents = nil.
-(void)invalidate
{
CATiledLayer *tiledLayer = (CATiledLayer *)[self layer];
tiledLayer.tileSize = CGSizeMake(93,93);//Set a different tile size
tiledLayer.tileSize = CGSizeMake(92,92);//Restore original tile size
}
This works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With