zoukankan      html  css  js  c++  java
  • invalid update:invalid number of rows in selection 0.The number of rows contained in an existing section after the update(38) must be equal to the number of rows contained in that selection.....

    当程序报这个错的时候:一般情况下是由于快速滑动过程中点击表中某一行,而且同时执行了此行的内容变化及其他方法同时执行造成。例如:字体变化、图片变化等引起的冲突,从而形成的程序崩溃。

    这里是由于在快速滑动过程中,点击了某一行。造成,表格还在滑动过程中,点击的一行执行字体变化,同时执行下载操作等一系列复杂操作。

    解决方法:想刷新表格同时执行其他操作。那就全局刷新表格吧

    用[weakSelf.tableView reloadData]代替单单对某一行的刷新。
    当然还有其他方法。也可以试试
    例如:重新获取数据加载表格等等。
    -(void)updateMessageStatusToAlreadyRead:(CommenModel *)model
    {
        NSString *url =[NSString stringWithFormat:@"%@/%@/*************",BASEURL,PLATFORM];
        NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
        NSDictionary *dic = @{@"id":model.ID.length?model.ID:@"",@"pid":model.pid.length?model.pid:@"",@"infoId":model.info_id.length?model.info_id:@"",@"type":@"oa_notice",@"pnid":model.pnid.length?model.pnid:@"",@"userId":userID};
        NSData * data = [NSJSONSerialization dataWithJSONObject:dic options:kNilOptions error:nil];
        NSString *dataStr = [[NSString alloc] initWithData:data
                                                  encoding:NSUTF8StringEncoding];
        [parameters setValue:dataStr forKey:@"__DATA"];
           __weak typeof(self)weakSelf = self;
        [NetRequestHelp createNetRequestWithURL:url parameters:parameters requestType:CYRequestMethodTypePOST responseSeializerType:CYResponseSeializerTypeJSON completionHandle:^(BOOL success, id responseObject, NSString *message) {
            if(success)
                {
    #ifdef  MESSAGENOTICE_OPEN_WITH_NO_REFRESH
                    if ([self.dataArray indexOfObject:model] != NSNotFound) {
                        NSInteger inde =[self.dataArray indexOfObject:model] ;
                        model.status = @"1";
                        [weakSelf.dataArray replaceObjectAtIndex:inde withObject:model];
                        NSIndexPath *indexPath = [NSIndexPath indexPathForRow:inde inSection:0];
    //                    [weakSelf.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
                        [weakSelf.tableView reloadData];//全局重新加载
                    }
    #else
                    [weakSelf refreshTable];
    #endif
                }
            else
                {
                
                }
        }];
    }
  • 相关阅读:
    和大家分享下我的找工作历程。
    Traits 编程技法+模板偏特化+template参数推导+内嵌型别编程技巧
    SGI STL空间配置器和内存池
    调试Release版本应用程序
    HawkNL 源码剖析
    C++:float 转型到 std::string 之总结。
    将一个数上调至2^n的倍数《参考STL源码》
    JavaScript中Ajax的使用
    jQuery之noConflict() 方法
    Linq to Object 的简单使用示例
  • 原文地址:https://www.cnblogs.com/OIMM/p/11239393.html
Copyright © 2011-2022 走看看