我有一个UITable视图,它填充了一些单元格。
很少有细胞有旋转的图像。使用动画旋转图像:
[image.layer removeAllAnimations];
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.duration = 1.0;
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 * 1.0 * rotationAnimation.duration ];
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = HUGE_VALF;
[image.layer addAnimation:rotationAnimation forKey:nil];
出于某种原因,并非所有图像都有动画。几乎就像我开始滚动表格一样,删除/禁用了一些动画。
出于某种原因
答案 0 :(得分:0)
更改最后一行以使用随机密钥:
[image.layer addAnimation:rotationAnimation forKey:[NSString stringWithFormat:@"%d", arc4random()]];
这解决了我的情况。