tableViewCell 插入

-(void)addRows{

   NSMutableArray *indexPaths = [[NSMutableArray alloc] init];

   NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];

  [indexPaths addObject: indexPath];

//这个位置应该在修改tableView之前将数据源先进行修改,否则会崩溃........必须向tableView的数据源数组中相应的添加一条数据

  [self.tableView beginUpdates];

  [self.tableView insertRowsAtIndexPaths:indexPathswithRowAnimation:UITableViewRowAnimationLeft];

  [self.tableView endUpdates];

}

你可能感兴趣的:(tableViewCell 插入)