|Mar 5, 2012, 04: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, 08: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, 11:13 AM||#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|
|SlideItOut Puzzle and Arcade Game for iPhone - Match3 or more + blocks + sliding tile||wiremuch||iPhone and iPod touch Apps||0||Mar 25, 2011 06:16 AM|
|iPod touch blanking out!||juders||iPod touch||3||Oct 3, 2007 08:29 PM|
|Call blanks out before getting somebody's voicemail||PmattF||iPhone||0||Sep 16, 2007 03:57 PM|
|Dock icon blank out, as well as whole dock, programs crashing||onlythecat||OS X||0||Feb 23, 2007 04:04 PM|
|Screen Blanking Out||MaxArturo||Mac Help/Tips||2||Mar 6, 2003 07:40 PM|
All times are GMT -5. The time now is 08:29 AM.