From fbf9fe9f2a975a1de572e16f0ad8a75083d6c178 Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Tue, 23 Dec 2025 14:37:11 +0800 Subject: [PATCH] 2 --- keyBoard/Class/Shop/V/KBCategoryTitleView.m | 8 ++++++++ keyBoard/Class/Shop/VC/KBShopVC.m | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/keyBoard/Class/Shop/V/KBCategoryTitleView.m b/keyBoard/Class/Shop/V/KBCategoryTitleView.m index b7f3d52..f437601 100644 --- a/keyBoard/Class/Shop/V/KBCategoryTitleView.m +++ b/keyBoard/Class/Shop/V/KBCategoryTitleView.m @@ -10,6 +10,8 @@ #import #import +static const CGFloat kKBCategoryMinTotalWidth = 56.0; + @implementation KBCategoryTitleView - (Class)preferredCellClass { @@ -29,4 +31,10 @@ right.titleCurrentColor = right.isSelected ? right.titleSelectedColor : right.titleNormalColor; } +- (CGFloat)preferredCellWidthAtIndex:(NSInteger)index { + CGFloat width = [super preferredCellWidthAtIndex:index]; + CGFloat minPreferredWidth = MAX(0.0, kKBCategoryMinTotalWidth - self.cellWidthIncrement); + return MAX(width, minPreferredWidth); +} + @end diff --git a/keyBoard/Class/Shop/VC/KBShopVC.m b/keyBoard/Class/Shop/VC/KBShopVC.m index a81fef1..88e23d7 100644 --- a/keyBoard/Class/Shop/VC/KBShopVC.m +++ b/keyBoard/Class/Shop/VC/KBShopVC.m @@ -109,7 +109,7 @@ static const CGFloat JXheightForHeaderInSection = 50; self.categoryView.cellBackgroundUnselectedColor = [UIColor colorWithHex:0xEFEFEF]; self.categoryView.cellBackgroundSelectedColor = [UIColor whiteColor]; self.categoryView.cellWidthIncrement = 20; - self.categoryView.cellSpacing = 12; + self.categoryView.cellSpacing = 12; self.categoryView.contentEdgeInsetLeft = 16; self.categoryView.contentEdgeInsetRight = 16; self.categoryView.averageCellSpacingEnabled = NO;