This commit is contained in:
2026-01-28 18:11:46 +08:00
parent 1b9ce1622d
commit 9a54a2ae6c
3 changed files with 56 additions and 24 deletions

View File

@@ -82,30 +82,39 @@
}
///
- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) {
__weak typeof(self) weakSelf = self;
//
UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
title:nil
handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
[weakSelf deleteItemAtIndexPath:indexPath];
completionHandler(YES);
}];
deleteAction.backgroundColor = [UIColor colorWithHex:0xF44336];
if (@available(iOS 13.0, *)) {
deleteAction.image = [UIImage systemImageNamed:@"trash.fill"];
}
UISwipeActionsConfiguration *config = [UISwipeActionsConfiguration configurationWithActions:@[deleteAction]];
config.performsFirstActionWithFullSwipe = NO;
return config;
}
//- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) {
//
// NSLog(@"[KBAIMessageListVC] trailingSwipeActionsConfigurationForRowAtIndexPath called for row: %ld", (long)indexPath.row);
//
// __weak typeof(self) weakSelf = self;
//
// //
// UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
// title:nil
// handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
// NSLog(@"[KBAIMessageListVC] Delete action triggered for row: %ld", (long)indexPath.row);
// [weakSelf deleteItemAtIndexPath:indexPath];
// completionHandler(YES);
// }];
// deleteAction.backgroundColor = [UIColor colorWithHex:0xF44336];
// if (@available(iOS 13.0, *)) {
// deleteAction.image = [UIImage systemImageNamed:@"trash.fill"];
// }
//
// UISwipeActionsConfiguration *config = [UISwipeActionsConfiguration configurationWithActions:@[deleteAction]];
// config.performsFirstActionWithFullSwipe = NO;
// return config;
//}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
//- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// NSLog(@"[KBAIMessageListVC] canEditRowAtIndexPath called for row: %ld", (long)indexPath.row);
// return YES;
//}
//- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
// NSLog(@"[KBAIMessageListVC] editingStyleForRowAtIndexPath called for row: %ld", (long)indexPath.row);
// return UITableViewCellEditingStyleDelete;
//}
#pragma mark - JXCategoryListContentViewDelegate