草庐IT

bottomAnim

全部标签

ios - 在动画完成之前更改 CALayer 内容

我致力于实现翻转卡片时钟动画的UI组件。一切正常,但是当我将顶部CALayer内容更改为新图像时,旧图像在更改之前保持可见。它会产生混淆效果。为了更好的解释,我将gif动画放在下面:这是更改CALayer内容的代码:firstTopLayer.contents=secondTopLayer.contentsletbottomAnim=CABasicAnimation(keyPath:"transform")bottomAnim.duration=animDuration/2bottomAnim.repeatCount=1bottomAnim.fromValue=NSValue.init