Created
February 3, 2012 18:48
-
-
Save pratikshabhisikar/1731706 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{ | |
| // Check if editing style is of type delete. | |
| if (editingStyle == UITableViewCellEditingStyleDelete) { | |
| // Create the delete index path. | |
| NSArray *deleteIndexPath = [[NSArray alloc] initWithObjects:indexPath, nil]; | |
| // Delete the object from the data source array corresponding to the "indexPath". I am assuming there is only one section in the table, thus just considering indexPath.row | |
| [myDatasourceArray deleteObjectAtIndex: indexPath.row]; | |
| // Now delete the actual cell from the table view. | |
| [tableView deleteRowsAtIndexPaths:deleteIndexPath withRowAnimation:UITableViewRowAnimationFade]; | |
| // Release the index path. | |
| [deleteIndexPath release]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment