CABasicAnimation resets to initial value after animation completes

后端 未结 15 2555
闹比i
闹比i 2020-12-04 05:44

I am rotating a CALayer and trying to stop it at its final position after animation is completed.

But after animation completes it resets to its initial position.

15条回答
  •  生来不讨喜
    2020-12-04 06:14

    Here's the answer, it's a combination of my answer and Krishnan's.

    cabasicanimation.fillMode = kCAFillModeForwards;
    cabasicanimation.removedOnCompletion = NO;
    

    The default value is kCAFillModeRemoved. (Which is the reset behavior you're seeing.)

提交回复
热议问题