Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用titleLabelZoomScale 属性时cellWidth计算不准确 #15

Closed
february29 opened this issue Aug 28, 2018 · 1 comment
Closed

使用titleLabelZoomScale 属性时cellWidth计算不准确 #15

february29 opened this issue Aug 28, 2018 · 1 comment

Comments

@february29
Copy link

  • (CGFloat)preferredCellWidthWithIndex:(NSInteger)index {
    if (self.cellWidth == JXCategoryViewAutomaticDimension) {
    return ceilf([self.titles[index] boundingRectWithSize:CGSizeMake(MAXFLOAT, self.bounds.size.height) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : self.titleFont} context:nil].size.width );
    }else {
    return self.cellWidth;
    }
    }

建议修改如下 方法 width * self.titleLabelZoomScale

  • (CGFloat)preferredCellWidthWithIndex:(NSInteger)index {
    if (self.cellWidth == JXCategoryViewAutomaticDimension) {
    return ceilf([self.titles[index] boundingRectWithSize:CGSizeMake(MAXFLOAT, self.bounds.size.height) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : self.titleFont} context:nil].size.width * self.titleLabelZoomScale);
    }else {
    return self.cellWidth;
    }
    }
@pujiaxin33
Copy link
Owner

你好,现在缩放有两种情况:
1、cell的子控件缩放,比如titleLabel、imageView。这种缩放不会涉及到cell宽度的变化;
2、cell宽度的缩放,属性是JXCategoryBaseView的cellWidthZoomScale,这种才会引起cell宽度变化,建议参考腾讯视频效果。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants