问题描述
当我的 UITableView 在制作动画时被释放,我的应用程序崩溃了.只要动画完成,应用程序就可以正常运行.下面是点击 UIButton 的结果,它调用 [tableView setContentOffset:offset animated:YES]; 然后闪电般快速点击 backBarButtonItem弹出 UITableViewController:
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.
在动画制作过程中停止 UITableView 或 UIScrollView 有什么想法吗?
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.]