我的动画代码被执行(我可以在任何动画行上使用断点来停止执行),但是我看不到任何东西。我什至花了我设置的第二秒时间,什么也不做,它只是执行下一个segue。我的文本字段应该在1秒内消失。
//animate text fields (fade till dissappear)
let animationTextFields = {() -> Void in
self.firstField.alpha = 0.0
self.secondField.alpha = 0.0
self.thirdField.alpha = 0.0
self.fourthField.alpha = 0.0
}
UIView.animate(withDuration: 1.0, animations: animationTextFields)
//animate next button (flies right)
//animate back button (flies left)
//animate "please" label (flies up)
self.performSegue (withIdentifier: "SegueToMainNavigation", sender: self)
如您所见,我还需要进一步的动画,但一次只需要一步。
知道为什么我的动画没有发生吗?
最佳答案
动画完成后放置segue。
UIView.animate(withDuration: 1.0, delay: 0.0, options: [], animations: animationTextFields, completion: { (finished: Bool) in
self.performSegue (withIdentifier: "SegueToMainNavigation", sender: self)
})
关于ios - Swift 3动画:代码运行但没有视觉效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44038700/