- (CGFloat)infoLbSize
{
CGSize maxSize = CGSizeMake(self.frame.size.width, MAXFLOAT);
NSDictionary *attrs = @{NSFontAttributeName : self.infoLb.font};
// 计算文字占据的高度
CGSize size = [self.infoLb.text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
return size.height;
}
Label适应文字大小
最新推荐文章于 2020-08-26 18:33:17 发布