animating adding/removing layers on iPhone

Posted by magesteve on Stack Overflow See other posts from Stack Overflow or by magesteve
Published on 2010-04-10T22:56:18Z Indexed on 2010/04/10 23:03 UTC
Read the original article Hit count: 200

Filed under:
|
|
|
|

On the iPhone, when you add a sub layer to a visible view's layer, using either -addSublayer: or -removeFromSuperlayer, shouldn't that sub layer appear or disappear in an animated manner (ie. fade in or fade out gradually)? My program animates using layers (not views). When I change a property of a layer like position or image content, then the change does animate (layer streaks around it's parent layer, the layer fades from the old image to the new image), so I obviously have the layers & view setup correctly. However, when I add or remove a sub layer, the change occurs instantly; there is no animation.

Reading the references, it says that if the layer is visible, the sub layer should animate when adder or removed.

What am I doing wrong? Has anyone had a similar problem, and was able to find a solution?

Thank you,

Steve Sheets

© Stack Overflow or respective owner

Related posts about iphone

Related posts about layers