UILabel设置行间距等属性:

UILabel设置行间距等属性:

 

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:contentLabel.text];;

            NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];

            [paragraphStyle setLineSpacing:5];

            [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, contentLabel.text.length)];

            

            contentLabel.attributedText = attributedString;

            //调节高度

            CGSize size = CGSizeMake(width, 500000);

            

            CGSize labelSize = [contentLabel sizeThatFits:size];

posted on 2015-08-28 18:06  ZQHE  阅读(171)  评论(0编辑  收藏  举报

导航