From 9a54a2ae6c46035e071cfc40321af7d7135d2c9e Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Wed, 28 Jan 2026 18:11:46 +0800 Subject: [PATCH] 1 --- keyBoard/Class/AiTalk/VC/KBAIMessageListVC.m | 55 ++++++++++++-------- keyBoard/Class/AiTalk/VC/KBAIMessageVC.m | 14 ++++- keyBoard/Class/AiTalk/VC/KBAIMessageZanVC.m | 11 ++++ 3 files changed, 56 insertions(+), 24 deletions(-) diff --git a/keyBoard/Class/AiTalk/VC/KBAIMessageListVC.m b/keyBoard/Class/AiTalk/VC/KBAIMessageListVC.m index 2d3ade3..894f37f 100644 --- a/keyBoard/Class/AiTalk/VC/KBAIMessageListVC.m +++ b/keyBoard/Class/AiTalk/VC/KBAIMessageListVC.m @@ -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 diff --git a/keyBoard/Class/AiTalk/VC/KBAIMessageVC.m b/keyBoard/Class/AiTalk/VC/KBAIMessageVC.m index 4ca77eb..6eea594 100644 --- a/keyBoard/Class/AiTalk/VC/KBAIMessageVC.m +++ b/keyBoard/Class/AiTalk/VC/KBAIMessageVC.m @@ -54,7 +54,7 @@ make.left.equalTo(self.kb_backButton.mas_right).offset(0); make.centerY.equalTo(self.kb_backButton); make.height.mas_equalTo(44); - make.width.mas_equalTo(180); + make.width.mas_equalTo(250); }]; // 添加搜索按钮 @@ -74,6 +74,10 @@ // 关联 categoryView 和 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:绑定事件 @@ -151,6 +155,14 @@ if (!_listContainerView) { _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]; _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; } diff --git a/keyBoard/Class/AiTalk/VC/KBAIMessageZanVC.m b/keyBoard/Class/AiTalk/VC/KBAIMessageZanVC.m index 2a4af44..9a5d6e5 100644 --- a/keyBoard/Class/AiTalk/VC/KBAIMessageZanVC.m +++ b/keyBoard/Class/AiTalk/VC/KBAIMessageZanVC.m @@ -26,6 +26,17 @@ [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:数据加载 - (void)loadData {