首页 > 其他 > 详细

通过文字计算lab高度

时间:2019-05-06 20:40:52      阅读:140      评论:0      收藏:0      [点我收藏+]

 

 

 1   var attrButes:[NSAttributedString.Key : Any]! = nil;
 2         let paraph = NSMutableParagraphStyle()
 3         paraph.lineSpacing = 8
 4         attrButes = [NSAttributedString.Key.font:UIFont.systemFont(ofSize: 13.5),NSAttributedString.Key.paragraphStyle:paraph]
 5         
 6         let size:CGRect = model.content!.boundingRect(with: CGSize(width: HL_APP_WIDTH - 30 , height: CGFloat.greatestFiniteMagnitude), options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: attrButes, context: nil)
 7         
 8 //        detailHeaderView.contTextLab.text = ""
 9         detailHeaderView.contTextLab.attributedText = NSAttributedString(string: model.content!, attributes: attrButes)
10         detailHeaderView.contTextLab.numberOfLines = 0
11         detailHeaderView.contTextLab.sizeToFit()
12         context_H = size.height 

 

通过文字计算lab高度

原文:https://www.cnblogs.com/-yun/p/10821419.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!