[英]Calling UIView animate withDuration on awakeFromNib does not do the animation
[英]UIView animate withDuration does not call the completion handler on iOS 9.3.5
我有這個動畫塊
UIView.animate(withDuration: 0.5, animations: {
self.holdingView.alpha = .5
}, completion: { (complete) in
if complete {
self.holdingView.removeFromSuperview()
}
})
}
但是無論出於什么原因,從未在iPhone上調用完成處理程序,而是在運行iOS 9.3.5的itouches上運行,但奇怪的是,在運行iOS 9.3.5的iPad Mini上調用了完成處理程序。
這一直很難調試,因為我在控制台中沒有任何錯誤。 另外,在所有iOS版本> 9.3.5上,完成處理程序也稱為
任何幫助或見識將不勝感激。
我只是面臨類似的問題。 我正在以一系列方式使我的觀點動起來。 我猜complementHandler正在嘗試連接到先前的動畫。 我按照以下步驟刪除了所有動畫,並且一切順利。
對於您的情況,請嘗試以下操作:
self.holdingView.layer.removeAllAnimations()
UIView.animate(withDuration: 0.5, animations: {
self.holdingView.alpha = .5
}, completion: { (complete) in
if complete {
self.holdingView.removeFromSuperview()
}
})
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.