4

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

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'

该代码仅在我仅设置一个选项时才有效。为什么不让我设置多个选项?

4

1 回答 1

10

组合的语法OptionSetType已经改变,你可以这样做:

UIView.animateWithDuration(0.5, delay: 0.4,
    options: [.Repeat, .CurveEaseOut, .Autoreverse], animations: {
        self.password.center.x += self.view.bounds.width
    }, completion: nil)
于 2015-07-21T13:55:50.887 回答