1
我需要在表中添加'ADD NEW ROW'单元格。我添加它,但我有问题完成它。在这个'setEditing'方法中,我不知道我需要在'paths'数组中放置什么?在UITableView中插入一行 - 缺少一些东西
-(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];
}
是的saadnib是正确的。当你这样做后,table将要求在tableView中添加一行:rowForIndexPath:这是你应该返回新的单元格对象的地方 – 2011-04-19 11:25:03
谢谢,就是这样。但在结束问题之前还有一件事。当我按下添加按钮代码进入'commitEditingStyle'方法。但我不明白。没有要求我为我的表输入新的项目名称? – 1110 2011-04-19 11:41:16
好的,我会添加新的视图添加图标点击添加项目。我会将其作为模态视图。 – 1110 2011-04-19 11:46:10