UILabel使用自适应高度,在一些高分辨率的设备上,顶部会有一条横线
gsk945 opened this issue · comments
gsk945 commented
高度只取int值的情况下就能消除这条横线,但是SDAutoLayout没找到设置成int的方法,是不是我看漏了什么?
han commented
我也遇到了这个问题
han 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);