错误集合

  • 1
Invalid update: invalid number of rows in section 1.  The number of rows contained in an existing section after the update (3) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

我的代码错误原因

// roloadData中描述
You should not call this method in the middle of animation blocks where items are being inserted or deleted. Insertions and deletions automatically cause the table’s data to be updated appropriately.
   // 代码中的逻辑有可能出现下面这种情况
    NSMutableArray *indexPathList = [NSMutableArray array];
    [indexPathList addObject:[NSIndexPath indexPathForRow:2 inSection:1]];
    [self.tableView reloadData];// roloadData在插入、删除或者刷新组时调用回报错,导致和numberOfSectionsInTableView:返回不一致,造成闪退
    [self.tableView insertRowsAtIndexPaths:indexPathList withRowAnimation:UITableViewRowAnimationAutomatic];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 练习项目,遇到所有问题都在这记录。 一、请求参数count需要使用NSString类型 1、开发中,接口文档有个参...
    耿杰阅读 4,237评论 2 0
  • 1.错误 null is not an object(evaluating 'internallnstance.g...
    suys_2017阅读 513评论 0 0
  • error code(错误代码)=0是操作成功完成。error code(错误代码)=1是功能错误。error c...
    Heikki_阅读 3,439评论 1 9
  • 最近项目在有一个功能 是利用opencv的一个功能,在集成opencv 的时候遇见了很多小问题 也是非常头疼的,在...
    船长One阅读 1,491评论 0 1
  • 错误1: unrecognized selector send to instance 问题原因:你想调用A函数,...
    白令海峡阅读 183评论 0 0