我有一个以应用程序开头的动画。当这个动画结束时,我需要调用另一个函数,但是我找不到执行它的过程。
这是我的动画代码:
func bettyAnimation(){
var betty: UIImageView = UIImageView()
var bettyImageList: [UIImage] = []
for i in 1...77{
let imageName = "pantalla_02_betty_\(i).png"
bettyImageList += [UIImage(named: imageName)!]
}
self.view.addSubview(betty)
betty.animationRepeatCount=1
betty.animationImages = bettyImageList
betty.animationDuration = 6.0
betty.startAnimating()
}
答案 0 :(得分:3)
您需要将代码放在completion
块中。
UIView.animateWithDuration(
// duration
1.0,
// delay
delay: 0.0,
options: nil,
animations: {
// put animation code here
}, completion: {finished in
// the code you put here will be executed when your animation finishes, therefore
// call your function here
}
)