有没有办法取消动画 UITableView/UIScrollView setConte

Is there a way to cancel an animated UITableView/UIScrollView setContentOffset:animated:?(有没有办法取消动画 UITableView/UIScrollView setContentOffset:animated:?)

本文介绍了有没有办法取消动画 UITableView/UIScrollView setContentOffset:animated:?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的 UITableView 在制作动画时被释放,我的应用程序崩溃了.只要动画完成,应用程序就可以正常运行.下面是点击 UIButton 的结果,它调用 [tableView setContentOffset:offset animated:YES]; 然后闪电般快速点击 backBarButtonItemUITableViewController:

My app is crashing when my UITableView is released whilst animating. The app functions without issue so long as the animation completes. Below is the result of a tap on the UIButton which calls [tableView setContentOffset:offset animated:YES]; and then a lightning quick tap on the backBarButtonItem which pops the UITableViewController:

#0  0x31ec3ebc in objc_msgSend
#1  0x33690248 in -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded]
#2  0x30defa14 in -[NSObject performSelector:withObject:]
#3  0x33690098 in -[UIAnimator stopAnimation:]
#4  0x3368fb7c in -[UIAnimator(Static) _advance:]
...

我从未见过 _scrollViewAnimationEnded 发生崩溃,显然 Google 也没有.我尝试从 UITableViewController- (void)viewWillDisappear:(BOOL)animated 调用 [tableView setContentOffset:offset animated:NO];方法,但这并没有解决问题.

I've never seen a crash on _scrollViewAnimationEnded and apparently neither has Google. I have tried calling [tableView setContentOffset:offset animated:NO]; from the UITableViewController's - (void)viewWillDisappear:(BOOL)animated method, but this did not solve the issue.

在动画制作过程中停止 UITableViewUIScrollView 有什么想法吗?

Any ideas for stopping a UITableView or UIScrollView in the midst of animating?

推荐答案

这看起来可能是委托问题.您是否有该表的代表,如果有,当该表存在时是否已解除分配?在释放它之前尝试将你的 tableView 的委托归零.

This looks like it might be a delegate issue. Do you have a delegate for the table, and, if so, is it dealloc'd when the table is? Try nil'ing out your tableView's delegate before releasing it.

[CoreAnimation 在动画时会保留 tableView,所以这可能不是问题.]

[The tableView is retained by CoreAnimation while it's animating, so that's probably not the problem.]

这篇关于有没有办法取消动画 UITableView/UIScrollView setContentOffset:animated:?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:有没有办法取消动画 UITableView/UIScrollView setConte

基础教程推荐