diff --git a/keyBoard/Class/Shop/V/KBCategoryTitleView.m b/keyBoard/Class/Shop/V/KBCategoryTitleView.m index 6c16713..b7f3d52 100644 --- a/keyBoard/Class/Shop/V/KBCategoryTitleView.m +++ b/keyBoard/Class/Shop/V/KBCategoryTitleView.m @@ -7,6 +7,8 @@ #import "KBCategoryTitleView.h" #import "KBCategoryTitleCell.h" +#import +#import @implementation KBCategoryTitleView @@ -14,5 +16,17 @@ return [KBCategoryTitleCell class]; } -@end +// 关闭左右滑动时的颜色/背景渐变(保持状态不变) +- (void)refreshLeftCellModel:(JXCategoryBaseCellModel *)leftCellModel + rightCellModel:(JXCategoryBaseCellModel *)rightCellModel + ratio:(CGFloat)ratio { + // 不调用 super,避免 JXCategoryIndicatorView/JXCategoryTitleView 内部的渐变计算 + JXCategoryTitleCellModel *left = (JXCategoryTitleCellModel *)leftCellModel; + JXCategoryTitleCellModel *right = (JXCategoryTitleCellModel *)rightCellModel; + // 固定颜色:选中用选中色,未选中用普通色 + left.titleCurrentColor = left.isSelected ? left.titleSelectedColor : left.titleNormalColor; + right.titleCurrentColor = right.isSelected ? right.titleSelectedColor : right.titleNormalColor; +} + +@end diff --git a/keyBoard/Class/Shop/VC/KBShopVC.m b/keyBoard/Class/Shop/VC/KBShopVC.m index 76e925a..7af20ca 100644 --- a/keyBoard/Class/Shop/VC/KBShopVC.m +++ b/keyBoard/Class/Shop/VC/KBShopVC.m @@ -49,7 +49,8 @@ static const CGFloat JXheightForHeaderInSection = 50; self.categoryView.delegate = self; self.categoryView.titleSelectedColor = [UIColor colorWithHex:0x1B1F1A]; self.categoryView.titleColor = [UIColor colorWithHex:0x9F9F9F]; - self.categoryView.titleColorGradientEnabled = YES; + // 左右滑动时不要文字渐变色 + self.categoryView.titleColorGradientEnabled = NO; // 不需要文字放大效果 self.categoryView.titleLabelZoomEnabled = NO; self.categoryView.contentScrollViewClickTransitionAnimationEnabled = NO; @@ -71,12 +72,15 @@ static const CGFloat JXheightForHeaderInSection = 50; backgroundView.indicatorColor = [UIColor whiteColor]; // keep selected fill white backgroundView.layer.borderColor = [UIColor colorWithHex:0x02BEAC].CGColor; backgroundView.layer.borderWidth = 1; + // 点击切换时不需要左右滚动动画,直接跳转到目标位置 + backgroundView.scrollEnabled = NO; + backgroundView.scrollAnimationDuration = 0; self.categoryView.indicators = @[backgroundView]; _pagerView = [self preferredPagingView]; self.pagerView.mainTableView.gestureDelegate = self; [self.view addSubview:self.pagerView]; - self.pagerView.listContainerView.scrollView.scrollEnabled = false; +// self.pagerView.listContainerView.scrollView.scrollEnabled = false; self.categoryView.listContainer = (id)self.pagerView.listContainerView;