Permalink
Browse files

Commit weils scho 12 Stunden coden san

  • Loading branch information...
1 parent 994cad1 commit 5deb35285f539d70c7dcc0b8cf3c3a3643f8208d Philip Messlehner committed Jan 18, 2010
Showing with 14 additions and 1 deletion.
  1. +14 −1 Classes/TagsFirstLevelController.m
@@ -147,12 +147,25 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd
NSUInteger row = [indexPath row];
NSError *error;
Tag *tag = [list objectAtIndex:row];
+
+ NSMutableArray *tasksToRemove = [NSMutableArray array];
+ for(Task *t in tag.tasks)
+ {
+ [tasksToRemove addObject:t];
+ }
+ for(Task *t in tasksToRemove)
+ {
+ [t removeTagsObject:tag];
+ }
+ [tag removeTasks:[NSSet setWithArray:tasksToRemove]];
+
+
DLog ("Try to delete Tag '%@'", tag.name);
[self.controllersSection1 removeObjectAtIndex:row];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];
DLog ("Removed Tag '%@' from SectionController", tag.name);
- if(![BaseManagedObject deleteObject:tag error:&error]) {
+ if(![BaseManagedObject deleteObjectFromPersistentStore:tag error:&error]) {
ALog("Error occured while deleting Tag");
}
else

0 comments on commit 5deb352

Please sign in to comment.