UIView animation vs CALayers UIView animation vs CALayers ios ios

UIView animation vs CALayers


Use views for control and layers for eye candy. Layers don't receive events so it's easier to use a view for those cases, but when you want to animate a sprite or backgrounds, etc., layers make sense. Events pass right through layers to the backing view so you can have a pretty visual representation without messing up your events. Try to overlay a view that you're just using for visual representation and you'll have to pass tap events through to the underlying view yourself.


An UIView is always rendered to a CALayer. When you use UIView methods to animate a view, you are effectively manipulating the underlying CALayer.

If you need to do simple things, use the UIView methods. For more complex situatins, or if you want layers not associated with any view in particular, use CALayers.


I've done a bunch of apps in the past year. Here's my rule of thumb:

  1. Use UIView until it doesn't do what you want.
  2. Then move to CoreAnimation. But before you get into it too much...
  3. If you write more than a few animations, use Cocos2D.