人到中年有点甜
[self.tableView beginUpdates]; NSString *newItem = [NSString stringWithFormat:@"Add Item %d",[_dataSource count]]; [_dataSource addObject:newItem]; NSArray *paths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:([_dataSource count] - 1) inSection:0]]; [self.tableView insertRowsAtIndexPaths:paths withRowAnimation:NO]; [self.tableView endUpdates]; 这里是添加一行,你要删除的话就remove: [_dataSource removeOjbectAtIndex:]; 然后调 - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;