Search code examples
iphoneiosipaduiimageviewcore-animation

CoreAnimation + Effects vs. Photoshop + UIImageView


I'm attempting to get an answer for the question posted here: CALayer performance vs. UIImageView performance.

Here's a modified excerpt from that question of the question that I'm seeking an answer for:

Is it a better idea to use CALayers and such for effects like bevel, drop shadow etc., or just do all that stuff in photoshop and use UIImage(View)s for whatever I need?


Solution

  • The answer is "it depends". It certainly takes less CPU to blit a static image onto the screen than to apply effects like shadow and drop shadow to the image before displaying it. PS is also a more widely understood tool, so more people know how to get any given effect out of it.

    However, if you want to apply a wide variety of effects to the same image, you will save storage space if you save the image once and then apply the effects as needed.

    The graphics hardware in iOS devices struggles with alpha blending. Shadows are particularly costly to render. However, it's the blending of shadow with the content underneath that's slow. You'll get a very similar performance impact if you have an image that's got partly transparent shadow areas in it vs creating those partly transparent shadow areas through Core Graphics or a CALayer.

    Graphics rendering performance very much depends on the details. You're going to have to do some testing and fine-tuning to get the best results.