NSLayoutManager
首先介绍NSLayoutManager,属于UITextKit核心类。
NSTextContainer。定义了文本可以排版的区域。默认情况下是矩形区域,如果是其他形状的区域,需要通过子类化NSTextContainer来创建。
NSLayoutManager。该类负责对文字进行编辑排版处理,将存储在NSTextStorage中的数据转换为可以在视图控件中显示的文本内容,并把字符编码映射到对应的字形上,然后将字形排版到NSTextContainer定义的区域中。
NSTextStorage。主要用来存储文本的字符和相关属性,是NSMutableAttributedString的子类。此外,当NSTextStorage中的字符或属性发生改变时,会通知NSLayoutManager,进而做到文本内容的显示更新。
NSAttributedString。支持渲染不同风格的文本。
NSMutableAttributedString。可变类型的NSAttributedString,是NSAttributedString的子类
*******************************************************************************************************
以前很古老的排版印刷中,工人(NSLayoutManager)从字体库中取出单个字母(NSTextStorage)组成要打印的版(NSTextStorage),然后印刷。
********************************************************************************************************
例子是实现在显示选择的所有条件(字体颜色,条件背景颜色等)



http://icell.io/layout-using-textkit/
http://www.ituring.com.cn/tupubarticle/2542
http://stackoverflow.com/questions/21857408/how-to-set-nsstrings-background-cornerradius-on-ios7