在完成之前取消UIView animateWithDuration [英] cancel a UIView animateWithDuration before completion
本文介绍了在完成之前取消UIView animateWithDuration的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的项目中有这个代码:
I have this code in my project:
- (void) fadeImageView {
[UIView animateWithDuration:1.0f
delay:0
options:UIViewAnimationCurveEaseInOut
animations:^{
self.imageView.alpha = 0.0f;
}
completion:^(BOOL finished) {
//make the image view un-tappable.
//if the fade was canceled, set the alpha to 1.0
}];
}
然而,有些情况我想取消这个在imageview变得不可见之前的操作。有没有办法在动画中期取消这个动画?
however, there are circumstance where i would like to cancel this operation before the imageview has become invisible. Is there a way to cancel this animation mid animation?
推荐答案
更新:更喜欢这个答案https://stackoverflow.com/a/21527129/194309
Update: prefer this answer https://stackoverflow.com/a/21527129/194309 from Borut Tomazin
这篇关于在完成之前取消UIView animateWithDuration的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文