This commit is contained in:
2025-12-23 14:37:11 +08:00
parent 8e4d7e1ee8
commit fbf9fe9f2a
2 changed files with 9 additions and 1 deletions

View File

@@ -10,6 +10,8 @@
#import <JXCategoryView/JXCategoryView.h>
#import <JXCategoryView/JXCategoryTitleCellModel.h>
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

View File

@@ -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;