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

UILabel使用自适应高度,在一些高分辨率的设备上,顶部会有一条横线 #335

Open
gsk945 opened this issue Oct 27, 2020 · 2 comments

Comments

@gsk945
Copy link

gsk945 commented Oct 27, 2020

高度只取int值的情况下就能消除这条横线,但是SDAutoLayout没找到设置成int的方法,是不是我看漏了什么?

@xiehan198712
Copy link

我也遇到了这个问题

@xiehan198712
Copy link

xiehan198712 commented Dec 21, 2020

可在label.text赋值后 重新 修正高度

    self.someLabel.numberOfLines = 0;
    CGSize fixSize = [self.someLabel sizeThatFits:CGSizeMake(self.size.width, CGFLOAT_MAX)];
    self.someLabel.sd_resetLayout
    .topSpaceToView(self.shopBgView, 10)
    .leftSpaceToView(self.contentView, 5)
    .rightSpaceToView(self.contentView, 5)
    .heightIs(fixSize.height);

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