Skip to content

Commit

Permalink
Allow deleting ROMs from the context menu in the iOS version
Browse files Browse the repository at this point in the history
  • Loading branch information
LIJI32 committed Aug 18, 2024
1 parent 2b2bb35 commit 795d772
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions iOS/GBLoadROMTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@ - (UIContextMenuConfiguration *)tableView:(UITableView *)tableView
return [UIContextMenuConfiguration configurationWithIdentifier:nil
previewProvider:nil
actionProvider:^UIMenu *(NSArray<UIMenuElement *> *suggestedActions) {
UIAction *deleteAction = [UIAction actionWithTitle:@"Delete"
image:[UIImage systemImageNamed:@"trash"]
identifier:nil
handler:^(__kindof UIAction * _Nonnull action) {
[self tableView:tableView
commitEditingStyle:UITableViewCellEditingStyleDelete
forRowAtIndexPath:indexPath];
}];
deleteAction.attributes = UIMenuElementAttributesDestructive;
return [UIMenu menuWithTitle:nil children:@[
[UIAction actionWithTitle:@"Rename"
image:[UIImage systemImageNamed:@"pencil"]
Expand All @@ -267,6 +276,7 @@ - (UIContextMenuConfiguration *)tableView:(UITableView *)tableView
[[GBROMManager sharedManager] duplicateROM:[GBROMManager sharedManager].allROMs[[indexPath indexAtPosition:1]]];
[self.tableView reloadData];
}],
deleteAction,
]];
}];
}
Expand Down

0 comments on commit 795d772

Please sign in to comment.