ED.*_*ED. 18 iphone tableview didselectrowatindexpath
在某些情况下,UITableView didSelectRowAtIndexPath
被调用两次导致错误Pushing the same view controller instance more than once is not supported
.
以下是事件的顺序:
TableView::didSelectRowAtIndexPath.
TableView::viewWillDisappear.
PushedViewController::viewWillAppear.
TableView::didSelectRowAtIndexPath.
Error: Pushing the same view controller instance more than once is not supported'
Run Code Online (Sandbox Code Playgroud)
唯一值得注意的是,UITableView是异步加载图像,但从不调用didSelectRowAtIndexPath
.此外,PushedViewController被重用,以避免每次在UITableView中选择单元格时重新加载它.
任何人都知道这可能导致什么?谢谢.
Den*_*kem 32
我也看到了这个问题,可能是1000个用户中的一个受到影响,或者更少.我可以清楚地看到两个didSelectRowAtIndexPath一个接一个地注册50毫秒.我的猜测是它是iOS中的一个错误 - 一旦推出了新的视图控制器,就不应该将新的指示器指向旧视图.唉,我们可能会编写代码来防范这种情况.这就是我的想法:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath {
if (self.navigationController.topViewController != self)
return;
... do other stuff
}
Run Code Online (Sandbox Code Playgroud)
在第一个“didSelectRow”之后禁用用户交互。在转换过程中,多次点击可能会“叠加”。
通常需要手指具有惊人灵巧的人才能做出这种行为,但仍然如此。
归档时间: |
|
查看次数: |
6271 次 |
最近记录: |