我用UIButton通過某些圖像製作了一個動畫。 下面的代碼:如何停止我的UIButton動畫SWIFT
@IBAction func Touchdown(sender: AnyObject) {
Izer.setImage(image1, forState: UIControlState.Normal)
Izer.imageView!.animationImages = [image1, image2, image3, image4, image5,
image6, image7,image8]
Izer.imageView!.animationDuration = 0.9
Izer.imageView!.startAnimating()
playButton.enabled = false
}
@IBAction func TouchUp(sender: AnyObject) {
soundRecorder.stop()
playButton.enabled = true
}
當我觸摸按鈕,動畫的開始。但我想通過我的Touchup功能來阻止它。
我該怎麼辦?
謝謝和抱歉,我的英語不好:(
您是否嘗試過在您的TouchUp方法中放入'Izer.imageView!.stopAnimating()'? –
@ Phoen1xUK Owwww男人謝謝你! – Moussdog
只是要添加此作爲答案,所以我們可以關閉該問題:) –