私の問題は、削除メソッドが正しい行を削除しないことです!
この tableView では、ユーザーは特別な日付の localNotifications を保存できます。したがって、複数の localNot を作成すると、delete メソッドは選択した行を削除しません! 最後のエントリのみを削除します...
- 26.02.2012 3 番目の削除
- 27.02.2012 秒を削除
- など...最初に削除
どうしたの?
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
if(tableView.editing && editingStyle== UITableViewCellEditingStyleDelete)
{
[tableView beginUpdates];
[[UIApplication sharedApplication] cancelLocalNotification:notification];
[notificationsArray removeObjectAtIndex:indexPath.row];
NSLog(@"%@", notification);
// Animate the deletion from the table.
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
[tableView endUpdates];
[tableView reloadData];
}
}
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the specified item to be editable.
// UITableViewCellEditingStyleNone;
return YES;
}