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/JXCategoryView.h>
#import <JXCategoryView/JXCategoryTitleCellModel.h> #import <JXCategoryView/JXCategoryTitleCellModel.h>
static const CGFloat kKBCategoryMinTotalWidth = 56.0;
@implementation KBCategoryTitleView @implementation KBCategoryTitleView
- (Class)preferredCellClass { - (Class)preferredCellClass {
@@ -29,4 +31,10 @@
right.titleCurrentColor = right.isSelected ? right.titleSelectedColor : right.titleNormalColor; 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 @end