|Mar 5, 2012, 05:05 AM||#1|
CATiledLayer blanks out tiles when redrawing
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)?
|Mar 12, 2012, 09:07 AM||#2|
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...
|May 4, 2012, 12:13 PM||#3|
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.
|Thread Tools||Search this Thread|
|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 04:53 PM|
|Redrawing states to equalize population||iMikeT||Politics, Religion, Social Issues||39||Aug 26, 2013 09:39 AM|
|Windows 8, is there a way to lock the tiles?||spinedoc77||Windows, Linux & Others on the Mac||0||Jun 24, 2012 04:33 PM|
All times are GMT -5. The time now is 02:14 AM.