lable计算行高
Posted 红街咖啡
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了lable计算行高相关的知识,希望对你有一定的参考价值。
_introduce.text=status.introduce; //设置行间距 NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:_introduce.text];; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; [paragraphStyle setLineSpacing:7]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, _introduce.text.length)]; _introduce.attributedText = attributedString; NSString *introduce=status.introduce; CGSize titleSize = [introduce boundingRectWithSize:CGSizeMake(KScreenWidth-80, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSParagraphStyleAttributeName:paragraphStyle} context:nil].size; CGFloat height=titleSize.height;
以上是关于lable计算行高的主要内容,如果未能解决你的问题,请参考以下文章