尝试在 Swift 中将变量传递给我的动画时出现以下错误:
Could not find member 'CurveEaseOut'
如果我手动输入度数,我的代码看起来不错:
UIView.animateWithDuration(2.0, delay: NSTimeInterval(0.0), options: .CurveEaseOut, animations: {
self.arrowImage.transform = CGAffineTransformMakeRotation((180.0 * CGFloat(M_PI)) / 180.0)
}, completion: nil)
但是如果我尝试使用变量,我会遇到问题:
var turn = Double()
turn = 180.0
UIView.animateWithDuration(2.0, delay: NSTimeInterval(0.0), options: .CurveEaseOut, animations: {
self.arrowImage.transform = CGAffineTransformMakeRotation((turn * CGFloat(M_PI)) / turn)
}, completion: nil)
也许这是我对 Double() 的使用?我尝试了各种不同的类型,但找不到解决方案。