No index path for table cell being reused 这个问题

来源:互联网 发布:误清空回收站恢复软件 编辑:程序博客网 时间:2024/05/19 00:36

问题原因是:我用nib自定义了一个cell。作为我的tableFootView.当然在我执行下面的这段代码的时候,tableFootView 的显示没有任何问题。委托也能正常执行。

  footCell = [[NSBundle mainBundle] loadNibNamed:@"RRTableFootBtnCell" owner:self options:nil][0];    self.tableView.tableFooterView = footCell;    footCell.delegate = self;

但是:当我有数据需要更新cell的时候,当我要执行下面的代码的时候,标题的error就出现了。而且我的tableFootView 也同时消失了。

 [self.tableView beginUpdates];    [self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationAutomatic];    [self.tableView endUpdates];

我在stackoverflow上找到了类似的问题。他时把section view作为cell导致的题目所述错误。

解决方案其实很简单:

 self.tableView.tableFooterView = footCell.contentView;
0 0