在 Swift 2 的 animateWithDuration 中设置选项
Setting options in animateWithDuration in Swift 2
我正在使用以下代码为文本字段设置动画:
UIView.animateWithDuration(0.5, delay: 0.4,
options: .Repeat | .Autoreverse | .CurveEaseOut, animations: {
self.password.center.x += self.view.bounds.width
}, completion: nil)
我收到错误 Could not find member 'Repeat'
该代码仅在我只设置一个选项时有效。 为什么不让我设置多个选项?
组合 OptionSetType
的语法已更改,您可以这样操作:
UIView.animateWithDuration(0.5, delay: 0.4,
options: [.Repeat, .CurveEaseOut, .Autoreverse], animations: {
self.password.center.x += self.view.bounds.width
}, completion: nil)
我正在使用以下代码为文本字段设置动画:
UIView.animateWithDuration(0.5, delay: 0.4,
options: .Repeat | .Autoreverse | .CurveEaseOut, animations: {
self.password.center.x += self.view.bounds.width
}, completion: nil)
我收到错误 Could not find member 'Repeat'
该代码仅在我只设置一个选项时有效。 为什么不让我设置多个选项?
组合 OptionSetType
的语法已更改,您可以这样操作:
UIView.animateWithDuration(0.5, delay: 0.4,
options: [.Repeat, .CurveEaseOut, .Autoreverse], animations: {
self.password.center.x += self.view.bounds.width
}, completion: nil)