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?