相关疑难解决方法(0)

有没有办法暂停CABasicAnimation?

我有一个iPhone的基本旋转动画.有什么方法可以"暂停"动画,以便保持视图的位置?我想这样做的一种方法是让动画"完成"而不是在其上调用"删除",我该怎么做?

CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2];
rotationAnimation.duration = 100;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = HUGE_VALF;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.fillMode = kCAFillModeForwards;
[myView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
Run Code Online (Sandbox Code Playgroud)

iphone core-animation cabasicanimation

45
推荐指数
3
解决办法
3万
查看次数

标签 统计

cabasicanimation ×1

core-animation ×1

iphone ×1