Multiple CAAnimations for animationDidStop method?

前端 未结 2 491
忘了有多久
忘了有多久 2020-12-25 13:58

I know you have to use this method to get the delegate method for when the animation has finished:

- (void)animationDidStop:(CAAnimation *)theAnimation finis         


        
2条回答
  •  再見小時候
    2020-12-25 14:27

    A CAAnimation object is supposed to be reused from time to time and that's why I don't like to give it a certain key (since it's not unique). What makes it unique is the association with a CALayer with addAnimation:forKey:. For this reason I use the following code in animationDidStop:

    if animation == layer.animationForKey(AnimationKeys.scaleUp) {
       // scaleUp animation has completed
    }
    

提交回复
热议问题