3 回答

TA貢獻(xiàn)1895條經(jīng)驗 獲得超7個贊
[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:];
然后調(diào)
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
- 3 回答
- 0 關(guān)注
- 1003 瀏覽
添加回答
舉報