Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)tableView:(UITableView *)tableView commitEditingStyle: (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
- if (editingStyle == UITableViewCellEditingStyleDelete) {
- NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
- NSString *file = [[path objectAtIndex:0] stringByAppendingPathComponent:@"hosts.plist"];
- NSMutableArray *newhosts = [[NSMutableArray alloc] initWithArray:hosts];
- [newhosts removeObjectAtIndex: indexPath.row];
- [newhosts writeToFile:file atomically:YES];
- hosts = newhosts;
- [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
- // [[NSNotificationCenter defaultCenter] postNotificationName:@"hostsSaved" object:nil];
- [table reloadData];
- [newhosts release];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement