Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread Display Modes
Old Mar 5, 2012, 04:05 AM   #1
macrumors member
Join Date: May 2009
Location: Germany
CATiledLayer blanks out tiles when redrawing

Hi folks,

I completely lost...

In my app I use a UIView backed by a CATiledLayer in a UIScrollView to implement infinite zooming: Works pretty well, when zooming in the tiles are redrawn using Core Graphics in the background, and updated to provide sharp content.

When I change some underlying data and the view must be redrawn, I trigger [view setNeedsDisplay], and the tiles are updated (unfortunately all tiles, but that seems to be a flaw in the CATiledLayer's design). But here comes the problem: Before each tile is redrawn, the complete view is turning blank, causing a kind of one-time flicker.

If I change the layer's class to CALayer, new content just replaces old one with a much smoother effect, so my drawRect: method is not causing the problem.

How do I implement a CATiledLayer which doesn't blank all tiles before redrawing them after a [view setNeedsDisplay]? Or what can I do to avoid at least the impact (e. g. creating my own backing layer behind the CATiledLayer)?

marndt is offline   0 Reply With Quote
Old Mar 12, 2012, 08:07 AM   #2
Thread Starter
macrumors member
Join Date: May 2009
Location: Germany
Just a quick reply in case sb's facing the same problem:

I was able to reproduce the effect with a completely stripped-down app: A CATiledLayer backed view erases all tiles before drawing them when [view setNeedsDisplay] is sent.

The following approach gives a much smoother user experiance: I added an empty UIView to the UIScrollView, as one view is required for a zoomable scrollview. Then I added two identical instances of my CATileLayered view to this dummy. When an update is needed I trigger the front view immediately, and the back view with a slight delay. As long as updates don't come too often, the back view is already rendered and gives a smooth transition...
marndt is offline   0 Reply With Quote
Old May 4, 2012, 11:13 AM   #3
macrumors newbie
Join Date: Mar 2012
I ran into this problem as well. The good news is that I've found a fix, and open-sourced it here:


The bad news is that it's not app-store approvable, because it uses a couple of undocumented methods on CATiledLayer (-canDrawRect:levelOfDetail: and -setNeedsDisplay:levelOfDetail.

I filed a radar on this a few months ago. Fortunately it's the sort of thing they could just flip over to published status and have it work from iOS 2.0 forward.
frankus is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Need help replicating metro UI tiles! Please and Thank you :D jonpeter Web Design and Development 7 Sep 24, 2013 03:53 PM
Redrawing states to equalize population iMikeT Politics, Religion, Social Issues 39 Aug 26, 2013 08:39 AM
Windows 8, is there a way to lock the tiles? spinedoc77 Windows, Linux & Others on the Mac 0 Jun 24, 2012 03:33 PM

Forum Jump

All times are GMT -5. The time now is 04:03 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC