生活随笔
收集整理的這篇文章主要介紹了
iOS基础 - 文本属性Attributes
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
NSKernAttributeName:?調整字句?kerning?字句調整NSFontAttributeName?:?[UIFont?systemFontOfSize:_fontSize]?設置字體NSForegroundColorAttributeName?:[UIColor?redColor]?設置文字顏色NSParagraphStyleAttributeName?:?paragraph?設置段落樣式NSMutableParagraphStyle?*paragraph?=?[[NSMutableParagraphStyle?alloc]?init];paragraph.alignment?=?NSTextAlignmentCenter;NSBackgroundColorAttributeName:?[UIColor?blackColor]?設置背景顏色NSStrokeColorAttributeName設置文字描邊顏色,需要和NSStrokeWidthAttributeName設置描邊寬度,這樣就能使文字空心.NSStrokeWidthAttributeName這個屬性所對應的值是一個?NSNumber?對象(小數)。該值改變描邊寬度(相對于字體size?的百分比)。默認為?0,即不改變。正數只改變描邊寬度。負數同時改變文字的描邊和填充寬度。同時設置了空心的兩個屬性,并且NSStrokeWidthAttributeName屬性設置為整數,文字前景色就無效果了NSStrikethroughStyleAttributeName?添加刪除線NSUnderlineStyleAttributeName?添加下劃線?NSShadowAttributeName?設置陰影,單獨設置不好使,必須和其他屬性搭配才好使。和這三個任一個都好使,NSVerticalGlyphFormAttributeName,NSObliquenessAttributeName,NSExpansionAttributeNameNSVerticalGlyphFormAttributeName該屬性所對應的值是一個?NSNumber?對象(整數)。0?表示橫排文本。1?表示豎排文本。在?iOS?中,總是使用橫排文本,0?以外的值都未定義。NSObliquenessAttributeName設置字體傾斜NSExpansionAttributeName?設置文本扁平化
轉載于:https://www.cnblogs.com/monicaios/p/3519972.html
總結
以上是生活随笔為你收集整理的iOS基础 - 文本属性Attributes的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。