CABasicAnimation在页面跳转再返回后,动画停止的解决办法

 CABasicAnimation *transformAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
        transformAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)]; transformAnimation.beginTime = CACurrentMediaTime();
        transformAnimation.duration = 2.0f;
        transformAnimation.repeatCount = HUGE_VALF;
        transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        [hh.layer addAnimation:transformAnimation forKey:@"transformAnimation"];

纵横四海一个呼吸灯动画,但是有个问题,每当界面跳转再回来,动画就没了
解决: 加一句transformAnimation.removedOnCompletion = NO;

你可能感兴趣的:(CABasicAnimation在页面跳转再返回后,动画停止的解决办法)