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
                {
                
                }
        }];
    }
  • 相关阅读:
    Mac开发——设置关闭窗口之后点击Dock中的图标可以再次打开窗口
    添加学院的 Exchange邮箱到手持设备中
    黑苹果 装SVN工具 cornerstone无法打开解决办法——网卡内建
    解决cocos2dx在Xcode中运行时报:convert: iCCP: known incorrect sRGB profile 的问题
    Lua中的正则表达式的使用
    C++11 标准新特性:Defaulted 和 Deleted 函数
    HTML5基础
    第一本书考试错题
    字符串
    带参数的方法
  • 原文地址:https://www.cnblogs.com/OIMM/p/11239393.html
Copyright © 2011-2022 走看看