zoukankan      html  css  js  c++  java
  • 更UIlabel改行间距

    / 更改行间距

                NSString *dLabelString = cell.Content.text;

                

                NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:dLabelString];

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

                

                //行间距

                [paragraphStyle setLineSpacing:5.0];

                //段落间距

                [paragraphStyle setParagraphSpacing:10.0];

                //第一行头缩进

                [paragraphStyle setFirstLineHeadIndent:15.0];

                //头部缩进

                //[paragraphStyle setHeadIndent:15.0];

                //尾部缩进

                //[paragraphStyle setTailIndent:250.0];

                //最小行高

                //[paragraphStyle setMinimumLineHeight:20.0];

                //最大行高

                //[paragraphStyle setMaximumLineHeight:20.0];

                

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

                [cell.Content setAttributedText:attributedString];

                

                [cell.Content setLineBreakMode:NSLineBreakByTruncatingTail];

                

                CGRect dlRect = cell.Content.frame;

                [cell.Content sizeToFit];

                CGRect dlRectNew = cell.Content.frame;

                if(dlRectNew.size.height>dlRect.size.height){  

                    dlRectNew.size.height = dlRect.size.height;  

                    [cell.Content setFrame:dlRectNew];

                }

  • 相关阅读:
    lnmp下如何建立svn版本库
    解决更新本地svn版本库,提示:工作副本已锁定 问题
    请不要在意
    ecshop在lbi库文件中添加广告位的方法(转载,试过了确实可以添加成功)
    Jquery AjaxUpload实现文件上传
    js提交表单错误:document.form.submit() is not a function
    kindeditor的使用方法
    phpcmsv9整合ucenter经验分享
    替换字符串sql语句
    初生牛犊之spring(二)
  • 原文地址:https://www.cnblogs.com/-ios/p/5834252.html
Copyright © 2011-2022 走看看