【发布时间】:2011-10-12 16:57:38
【问题描述】:
我有一个填充一些单元格的 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];
由于某种原因,并非所有图像都有动画。似乎当我开始滚动表格时,一些动画被删除/禁用了。
由于某种原因
【问题讨论】:
-
你在哪里制作动画?你知道 UITableView 重用了它的单元格吗?您知道单元重用机制的工作原理吗?
-
此代码正在由单元格项目的方法执行。我在重用(或创建)一个单元格后调用它。在 cellForRowAtIndexPath: MyCell* cell={dequeue or create new cell}; [单元格动画];
-
你有没有得到任何地方?
标签: iphone uitableview animation sdk caanimation