完成后停止删除CABasicAnimation

时间:2011-03-15 22:48:13

标签: iphone calayer caanimation cabasicanimation

嘿,我有这个代码片段(持续时间为.5,金额为1.5)

CABasicAnimation *grow = [CABasicAnimation animationWithKeyPath:@"transform"];
grow.duration = duration;
grow.repeatCount = 0;
grow.removedOnCompletion = NO;
grow.autoreverses = NO;
grow.fromValue = [NSValue valueWithCATransform3D:CATransform3DScale(self.layer.transform, 1.0, 1.0, 1.0)];
grow.toValue = [NSValue valueWithCATransform3D:CATransform3DScale(self.layer.transform, amount, amount, amount)];
grow.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[self.layer addAnimation:grow forKey:@"grow"];

然而,当播放时,UIView正常增长,但随后快速恢复到其起始值。我认为“removedOnCompletion”应该是为了阻止这个?

1 个答案:

答案 0 :(得分:18)

看起来我还需要指定:

  grow.fillMode = kCAFillModeForwards;

去图。现在工作:)