【问题标题】:Stop CABasicAnimation from being removed after completion完成后停止 CABasicAnimation 被移除
【发布时间】:2011-07-16 04:42:24
【问题描述】:

嘿,我有这个代码 sn-p(持续时间是 0.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”应该防止这种情况发生?

【问题讨论】:

    标签: iphone calayer caanimation cabasicanimation


    【解决方案1】:

    看来我还需要指定:

      grow.fillMode = kCAFillModeForwards;
    

    去图吧。现在工作:)

    【讨论】:

    • 好线!正是我需要的!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-12
    • 1970-01-01
    • 2012-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多