small medium large xlarge

21 Jul 2009, 16:03
Christoph Ludwig (13 posts)


I have an iPhone app that has kind of a background grid that responds to the user’s pinch / stretch gestures. (The event handler sets the layer’s transformation to CATransform3DMakeScale(scaleFactor, 1.0, 1.0) with the intended effect.)

At some point I need to replace the grid with a version suited for the next zoom level. I put fade in/out animations to the incoming and outgoing layers’ action dictionaries (for the keys kCAOnOrderIn and kCAOnOrderOut, respectively) and then call [holderLayer replaceSublayer:outgoingLayer with:incomingLayer].

That works fine except that there’s a lot of flicker and artefacts when the layers are replaced. Most of the time it’s that part of the screen becomes red (even though nothing currently displayed on the screen is red) or that there are many vertical white lines from top to bottom. It’s only for the fraction of a second, but it’s reported by my testers as well and it is quite annoying.

Any idea as to how this can be avoided?



28 Jul 2009, 17:27
Bill Dudney (916 posts)

Hi Christoph,

Are you replacing many layers at once?

Can you try instead turning off animations all together. The maps app takes this approach and replaces the tiles when the zoom level changes sufficiently.

Good luck!

10 Aug 2009, 16:31
Christoph Ludwig (13 posts)

Hi Bill,

[hm, for some reason I was not notified of your reply, even though the “Monitoring Topic” box is checked.]

no, in this case it is only one layer that covers the entire background. I may have to go the route without animations even though the background change may then be rather abrupt.

Someone claimed on Apple’s Dev Forum that Core Animations would be much less likely to produce flicker in iPhone OS 3.1. I cannot join the beta whence I cannot verify this statement.



You must be logged in to comment