插入行不适用于OBJ C.

时间:2016-08-23 09:17:44

标签: objective-c json pagination ios9

如何修复此代码,我尝试在索引0处添加另一个单元格但是有异常日志显示

更新后的现有部分中包含的行数(10)必须等于更新前该部分中包含的行数(10)

if([fetchedresult count]>1) {
   for (int i=0; i<[fetchedresult count]; i++) {  
      dataDict = [fetchedresult objectAtIndex:i];
      //Some Code to fill commentResult                     
      commentResult = [NSMutableDictionary dictionaryWithObjectsAndKeys:idUserComment,[fieldName ID],image,[fieldName PHOTO],username,[fieldName USERNAME],body,[fieldName BODYCOMMENT],createdAt,[fieldName CREATEDAT], nil];

      [tblComment beginUpdates];
      NSArray *indexPathArray = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:0]];
      NSArray *lastArray = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:9 inSection:0]];
      [tblComment deleteRowsAtIndexPaths:lastArray withRowAnimation:UITableViewRowAnimationFade];
      [dataCommentField insertObject:commentResult atIndex:0];
      [tblComment reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationNone];
      [tblComment endUpdates];                    
      }
   }
}

0 个答案:

没有答案