我有这样的代码从数据库的UITableView编辑惑
- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[appDelegate.indexArray removeObjectAtIndex:indexPath.section];
[appDelegate.notesArray removeObjectAtIndex:indexPath.section];
[tableViewObj reloadData];
NSString *DataPath = [MyBibleAppAppDelegate getPath];
[appDelegate.data writeToFile:DataPath atomically:YES];
[tableViewObj reloadData];
}
}
它完美的作品删除单元格的内容,但我需要把上面的代码在我按一下按钮,我把这个按钮点击
-(IBAction)_clickbtndeltNoteall:(id)sender
{
[appDelegate.indexArray removeObjectAtIndex:indexPath.section];
[appDelegate.notesArray removeObjectAtIndex:indexPath.section];
[tableViewObj reloadData];
NSString *DataPath = [MyBibleAppAppDelegate getPath];
[appDelegate.data writeToFile:DataPath atomically:YES];
[tableViewObj reloadData];
}
但我得到这个错误:“未声明的标识符索引路径”。如何解决这个问题?
挑战你会得到这样的感觉。在.h文件中采用一个NSIndexPath对象,并在commitEditingStyle方法中赋值并在你的按钮动作方法中使用该对象 – Narayana 2012-03-01 10:26:03