Search code examples
iphoneiosipaddrawingcore-animation

iPad image ghosting when displaying images rapidly


I'm displaying a series of images on an iPad that are being sent over a network connection. It seems to work fine, but the images have a lot of ghosting for some reason (see image below). Is there some kind of technique for drawing that would eliminate this? I'd say it's an issue with the refresh rate of the screen, but that wouldn't explain why using the iPad's screenshot functionality captures the phenomenon.

Ghosting on iPad


Solution

  • You are probably switching between images in a way that triggers an implicit animation that cross-fades between the old image and the new one.

    The documentation for layer actions explains how CoreAnimation is deciding to run that implicit animation, and how to override it.

    The two easiest ways IMHO are:

    1. When you change the image, use a CATransaction to disable actions
    2. In your layer's delegate, implement -actionForLayer:forKey: and return [NSNull null]. (If you are using a UIView, it's already the layer's delegate.)

    This question gives a few more options -- it might even be a duplicate of your situation.