gsdios / SDAutoLayout

One line of code to implement automatic layout. 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于做最简单易用的AutoLayout库。The most easy way for autoLayout. Based on runtime.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

gsk945 opened this issue · comments

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

commented

我也遇到了这个问题

commented

可在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);