3 回答

人到中年有點甜
TA貢獻1895條經驗 獲得超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:];
然后調
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
- 3 回答
- 0 關注
- 981 瀏覽
添加回答
舉報
0/150
提交
取消