我正在为我的应用程序做书签模块。当我从 TableView 中删除行时,表中的最后一行被删除,但从数据库中选定的行被删除。问题是在表格视图中显示数据时
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
[[UIBarButtonItem appearanceWhenContainedIn:[UIPopoverController class], nil]
setTintColor:[UIColor grayColor]];
if (editingStyle == UITableViewCellEditingStyleDelete)
{
Cart *cartObj = [appDelegate.bookmarkArray objectAtIndex:indexPath.row];
[appDelegate removeCart:cartObj];
[bookmarkIDArray removeObjectAtIndex:indexPath.row];
[bookmarkTableview beginUpdates];
[bookmarkTableview deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
//[bookmarkTableview deleteSections:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[bookmarkTableview endUpdates];
[bookmarkTableview reloadData];
}
if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}