字體富文本的設(shè)置

效果還是自己體驗吧~~~常用哦


1.NSKernAttributeName: @10 調(diào)整字句 kerning 字句調(diào)整

2.NSFontAttributeName : [UIFont systemFontOfSize:_fontSize] 設(shè)置字體

3.NSForegroundColorAttributeName :[UIColor redColor] 設(shè)置文字顏色

4.NSParagraphStyleAttributeName : paragraph 設(shè)置段落樣式

5.NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];

paragraph.alignment = NSTextAlignmentCenter;

6.NSBackgroundColorAttributeName: [UIColor blackColor] 設(shè)置背景顏色

7.NSStrokeColorAttributeName設(shè)置文字描邊顏色,需要和NSStrokeWidthAttributeName設(shè)置描邊寬度,這樣就能使文字空心.

NSStrokeWidthAttributeName這個屬性所對應(yīng)的值是一個 NSNumber 對象(小數(shù))。該值改變描邊寬度(相對于字體size 的百分比)。默認(rèn)為 0,即不改變。正數(shù)只改變描邊寬度。負(fù)數(shù)同時改變文字的描邊和填充寬度。例如,對于常見的空心字,這個值通常為3.0。

同時設(shè)置了空心的兩個屬性,并且NSStrokeWidthAttributeName屬性設(shè)置為整數(shù),文字前景色就無效果了


8. NSStrikethroughStyleAttributeName 添加刪除線,strikethrough刪除線


9. NSUnderlineStyleAttributeName 添加下劃線


10. NSShadowAttributeName 設(shè)置陰影,單獨(dú)設(shè)置不好使,必須和其他屬性搭配才好使。

和這三個任一個都好使,NSVerticalGlyphFormAttributeName,NSObliquenessAttributeName,NSExpansionAttributeName

11.NSVerticalGlyphFormAttributeName

該屬性所對應(yīng)的值是一個 NSNumber 對象(整數(shù))。0 表示橫排文本。1 表示豎排文本。在 iOS 中,總是使用橫排文本,0 以外的值都未定義。


12. NSObliquenessAttributeName設(shè)置字體傾斜。Skew 斜


13. NSExpansionAttributeName 設(shè)置文本扁平化

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容