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)) { //- (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;
//}
__weak typeof(self) weakSelf = self; //- (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 {
UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive // NSLog(@"[KBAIMessageListVC] editingStyleForRowAtIndexPath called for row: %ld", (long)indexPath.row);
title:nil // return UITableViewCellEditingStyleDelete;
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;
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
#pragma mark - JXCategoryListContentViewDelegate #pragma mark - JXCategoryListContentViewDelegate

View File

@@ -54,7 +54,7 @@
make.left.equalTo(self.kb_backButton.mas_right).offset(0); make.left.equalTo(self.kb_backButton.mas_right).offset(0);
make.centerY.equalTo(self.kb_backButton); make.centerY.equalTo(self.kb_backButton);
make.height.mas_equalTo(44); make.height.mas_equalTo(44);
make.width.mas_equalTo(180); make.width.mas_equalTo(250);
}]; }];
// //
@@ -74,6 +74,10 @@
// categoryView listContainerView // categoryView listContainerView
self.categoryView.listContainer = self.listContainerView; self.categoryView.listContainer = self.listContainerView;
// tab (Thumbs Up)
// self.listContainerView.scrollView.scrollEnabled = YES;
self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0);
} }
#pragma mark - 2 #pragma mark - 2
@@ -151,6 +155,14 @@
if (!_listContainerView) { if (!_listContainerView) {
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]; _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
_listContainerView.scrollView.bounces = NO; _listContainerView.scrollView.bounces = NO;
// _listContainerView.scrollView.scrollEnabled = false;
//
// for (UIGestureRecognizer *gestureRecognizer in _listContainerView.scrollView.gestureRecognizers) {
// if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
// gestureRecognizer.delaysTouchesBegan = NO;
// }
// }
} }
return _listContainerView; return _listContainerView;
} }

View File

@@ -26,6 +26,17 @@
[super viewDidLoad]; [super viewDidLoad];
} }
#pragma mark - UITableViewDelegate Override
// Thumbs Up tab
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return NO; //
}
- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) {
return nil; //
}
#pragma mark - 2 #pragma mark - 2
- (void)loadData { - (void)loadData {