Is there a way to cancel an animated UITableView/UIScrollView setContentOffset:animated:?(有没有办法取消动画 UITableView/UIScrollView setContentOffset:animated:?)
问题描述
当我的 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.]
这篇关于有没有办法取消动画 UITableView/UIScrollView setContentOffset:animated:?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:有没有办法取消动画 UITableView/UIScrollView setConte
基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
