makingitbest

导航

RichText

RichText

 

效果 

 

特点

1.按照需要调节部分字体的颜色

2.调节段落的行间距,字间距

 

源码

github:https://github.com/makingitbest/RichText

 

细节

1.富文本的设置常用的有以下几种

 

2.段落样式的设置

   NSMutableParagraphStyle *style = [NSMutableParagraphStyle new]; //初始化

    style.paragraphSpacing            = 20;  // 段间距

    style.lineSpacing                      = 2;    // 行间距

    style.firstLineHeadIndent          = 26.f; // 段落开头的缩进,按字体大小,缩进它的两倍

    [string addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, text.length)];

posted on 2016-09-19 17:36  makingitbest  阅读(363)  评论(0编辑  收藏  举报