码迷,mamicode.com
首页 > 其他好文 > 详细

lable计算行高

时间:2016-05-26 11:32:22      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
 _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;
    
View Code

 

lable计算行高

标签:

原文地址:http://www.cnblogs.com/ithongjie/p/5530356.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!