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)];

原文地址:https://www.cnblogs.com/makingitbest/p/5881394.html