我不知道如何在不使用計時器概念的情況下停止此通話。今天,試圖剖析我碰到這種分配內存附帶的項目時得到提高,因爲下面的函數的每一次:如何在轉到另一個視圖控制器時停止後臺調用?
func startAnimation(index: Int) {
UIView.animate(withDuration: 4.0, delay: 0.5, options:[UIViewAnimationOptions.allowUserInteraction, UIViewAnimationOptions.curveEaseInOut], animations: {
self.view.backgroundColor = self.colors[index]
}) { (finished) in
var currentIndex = index + 1
if currentIndex == self.colors.count { currentIndex = 0 }
self.startAnimation(index: currentIndex)
}
}
是的,我用同樣的方法。 – sharayu