我用一個動畫指定一個提示,以幫助使用這些與延遲的相互作用:停止dispatch_after
let delay = 1.8 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue()) {
//call the method which have the steps after delay.
self.rain.alpha = 0
UIView.animateWithDuration(5, animations: {
self.rain.alpha = 1
})
self.tip.startAnimating()
}
但是,我需要的,如果,動畫開始前,用戶觸摸屏幕來停止這種延遲的過程。
的可能的複製[取消在夫特定時事件?](http://stackoverflow.com/questions/28359768/cancel-a-timed-event- in-swift) – 2016-09-25 07:48:23