Created
November 8, 2010 11:00
-
-
Save aurels/667585 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { | |
| if (editingStyle == UITableViewCellEditingStyleDelete) { | |
| NSLog(@"Deleting Task!"); | |
| Task *taskToRemove = [tasksArray objectAtIndex:indexPath.row]; | |
| //remove from taskArray | |
| [tasksArray removeObjectAtIndex:indexPath.row]; | |
| //remove from core data and on server | |
| [dm removeTask:taskToRemove]; | |
| //remove from UI | |
| [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; | |
| } | |
| else if(editingStyle == UITableViewCellEditingStyleInsert) { | |
| //load create task view | |
| CreateTasksViewController *createTasksViewController = [[CreateTasksViewController alloc] initWithNibName:@"CreateTasksViewController" bundle:nil]; | |
| [createTasksViewController initWithDataManager:dm]; | |
| [self.navigationController pushViewController:createTasksViewController animated:YES]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment