【发布时间】:2016-04-29 17:28:13
【问题描述】:
假设我有一个水平长的矩形。它是蓝色的。我希望它是红色的。但是,我希望颜色变化从一侧开始并在另一侧结束。
我可以使用关键帧动画让整个视图逐渐从红色变为蓝色。有没有办法从左-右/右-左逐渐改变??
UIView.animateKeyframesWithDuration(2.0 /*Total*/, delay: 0.0, options: UIViewKeyframeAnimationOptions.CalculationModeLinear, animations: {
UIView.addKeyframeWithRelativeStartTime(0.0, relativeDuration: 1/1, animations:{
self.view.backgroundColor = UIColor.redColor()
self.view.layoutIfNeeded()
})
},
completion: { finished in
if (!finished) { return }
})
【问题讨论】:
标签: ios swift uiviewanimation