mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-02 17:33:15 +02:00
Allow deleting ROMs from the context menu in the iOS version
This commit is contained in:
@@ -253,6 +253,15 @@ contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
|
|||||||
return [UIContextMenuConfiguration configurationWithIdentifier:nil
|
return [UIContextMenuConfiguration configurationWithIdentifier:nil
|
||||||
previewProvider:nil
|
previewProvider:nil
|
||||||
actionProvider:^UIMenu *(NSArray<UIMenuElement *> *suggestedActions) {
|
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:@[
|
return [UIMenu menuWithTitle:nil children:@[
|
||||||
[UIAction actionWithTitle:@"Rename"
|
[UIAction actionWithTitle:@"Rename"
|
||||||
image:[UIImage systemImageNamed:@"pencil"]
|
image:[UIImage systemImageNamed:@"pencil"]
|
||||||
@@ -267,6 +276,7 @@ contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
|
|||||||
[[GBROMManager sharedManager] duplicateROM:[GBROMManager sharedManager].allROMs[[indexPath indexAtPosition:1]]];
|
[[GBROMManager sharedManager] duplicateROM:[GBROMManager sharedManager].allROMs[[indexPath indexAtPosition:1]]];
|
||||||
[self.tableView reloadData];
|
[self.tableView reloadData];
|
||||||
}],
|
}],
|
||||||
|
deleteAction,
|
||||||
]];
|
]];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user