How to remove a layer when its animation completes?

后端 未结 4 558
陌清茗
陌清茗 2020-12-19 13:28

I am making an iOS App. I have several CALayer objects that eventually will be deleted by a (shrinking) animation. When the animatio

4条回答
  •  借酒劲吻你
    2020-12-19 13:55

    When you create the animation and set the delegate, just pass the CALayer you want to remove with your animation.

    As for removing all the animations, you have two options:

    1. You can check your CALayer's animationKeys for any existing animations.
    2. You can use a CAAnimationGroup and group all your animations together.

提交回复
热议问题