画面に順番に表示しようとしているボタンの IBOutlet コレクションがあります。それらはすべて画面から正常に開始されますが、アニメーションが開始されると、各ボタンが前のボタンの 0.05 秒後に画面に表示されるようにしたいと思います。UIView.animateWithDuration で遅延を増やす方法がわかりません。以下のコードでは、それらはすべて画面上で同時にアニメーション化されています。
//outlet collection
@IBOutlet var options: [UIButton]!
let increment = 0.25
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
for button in options {
button.center.y += view.bounds.height
}
}
override func viewDidLoad() {
super.viewDidLoad()
for button in options {
UIView.animateWithDuration(1.0, delay: increment, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.0, options: nil, animations: {
button.center.y -= self.view.bounds.height
self.increment + 0.05
}, completion: nil)
}
}