我需要在表格中添加“ADD NEW ROW”单元格。我添加它但我有问题来完成它。在这个'setEditing'方法中,我不知道我需要在'paths'数组中放入什么?
-(void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[self.tableView setEditing:editing animated:animated];
//[self.tableView reloadData];
NSMutableArray* paths = [[NSMutableArray alloc] init];
// fill paths of insertion rows here
if( editing )
[self.tableView insertRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationBottom];
else
[self.tableView deleteRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationBottom];
[paths release];
}
答案 0 :(得分:2)
您必须在此路径数组中添加indexPath的对象。您可以将NSIndexPath实例创建为 -
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];