在Swift 2中设置animateWithDuration中的选项

Mor*_*Man 4 uiview animatewithduration swift2

我使用以下代码为文本字段设置动画:

UIView.animateWithDuration(0.5, delay: 0.4,
        options: .Repeat | .Autoreverse | .CurveEaseOut, animations: {
            self.password.center.x += self.view.bounds.width
        }, completion: nil)
Run Code Online (Sandbox Code Playgroud)

我收到了错误 Could not find member 'Repeat'

只有在我只设置一个选项时,代码才有效.为什么不让我设置多个选项?

sim*_*eon 10

组合的语法OptionSetType已更改,您可以这样做:

UIView.animateWithDuration(0.5, delay: 0.4,
    options: [.Repeat, .CurveEaseOut, .Autoreverse], animations: {
        self.password.center.x += self.view.bounds.width
    }, completion: nil)
Run Code Online (Sandbox Code Playgroud)