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'

このコードは、オプションを 1 つだけ設定した場合にのみ機能します。複数のオプションを設定できないのはなぜですか?

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 に答える