iOS富文本

NSString *const NSFontAttributeName;(字體) NSString *const NSParagraphStyleAttributeName;(段落) NSString *const NSForegroundColorAttributeName;(字體顏色) NSString *const NSBackgroundColorAttributeName;(字體背景色) NSString *const NSLigatureAttributeName;(連字符) NSString *const NSKernAttributeName;(字間距) NSString *const NSStrikethroughStyleAttributeName;(刪除線) NSString *const NSUnderlineStyleAttributeName;(下劃線) NSString *const NSStrokeColorAttributeName;(邊線顏色) NSString *const NSStrokeWidthAttributeName;(邊線寬度) NSString *const NSShadowAttributeName;(陰影)(橫豎排版) NSString *const NSVerticalGlyphFormAttributeName;字體

常量

  • 1> NSFontAttributeName(字體)spa

NSFontAttributeName(字體)

該屬性所對應的值是一個 UIFont 對象。該屬性用於改變一段文本的字體。若是不指定該屬性,則默認爲12-point Helvetica(Neue)。
  • 2> NSParagraphStyleAttributeName(段落)code

  NSParagraphStyleAttributeName(段落)

  -  該屬性所對應的值是一個 NSParagraphStyle 對象。該屬性在一段文本上應用多個屬性。若是不指定該屬性,則默認爲 NSParagraphStyle 的defaultParagraphStyle 方法返回的默認段落屬性。
  • 3> NSForegroundColorAttributeName(字體顏色)orm

  NSForegroundColorAttributeName(字體顏色)

   -  該屬性所對應的值是一個 UIColor 對象。該屬性用於指定一段文本的字體顏色。若是不指定該屬性,則默認爲黑色。
  • 4> NSBackgroundColorAttributeName(字體背景色)對象

NSBackgroundColorAttributeName(字體背景色)

  -   該屬性所對應的值是一個 UIColor 對象。該屬性用於指定一段文本的背景顏色。若是不指定該屬性,則默認無背景色。
  • 5> NSLigatureAttributeName(連字符)string

 NSLigatureAttributeName(連字符)

   -  該屬性所對應的值是一個 NSNumber 對象(整數)。連體字符是指某些連在一塊兒的字符,它們採用單個的圖元符號。0 表示沒有連體字符。1 表示使用默認的連體字符。2表示使用全部連體符號。默認值爲 1(注意,iOS 不支持值爲 2)。
  • 6> NSKernAttributeName(字間距)class

NSKernAttributeName(字間距)

   -  該屬性所對應的值是一個 NSNumber 對象(整數)。字母緊排指定了用於調整字距的像素點數。字母緊排的效果依賴於字體。值爲 0 表示不使用字母緊排。默認值爲0。
  • 7> NSStrikethroughStyleAttributeName(刪除線)object

NSStrikethroughStyleAttributeName(刪除線)

   -  該屬性所對應的值是一個 NSNumber 對象(整數)。該值指定是否在文字上加上刪除線,該值參考「Underline Style Attributes」。默認值是NSUnderlineStyleNone。
  • 8> NSUnderlineStyleAttributeName(下劃線)方法

   NSUnderlineStyleAttributeName(下劃線)

   -  該屬性所對應的值是一個 NSNumber 對象(整數)。該值指定是否在文字上加上下劃線,該值參考「Underline Style Attributes」。默認值是NSUnderlineStyleNone。。
  • 9> NSStrokeColorAttributeName(邊線顏色)poi

   NSStrokeColorAttributeName(邊線顏色)
   -  該屬性所對應的值是一個 UIColor 對象。若是該屬性不指定(默認),則等同於 NSForegroundColorAttributeName。不然,指定爲刪除線或下劃線顏色。更多細節見「Drawing attributedstrings that are both filled and stroked」。。
  • 10> NSStrokeWidthAttributeName(邊線寬度)

 NSStrokeWidthAttributeName(邊線寬度)

  -   該屬性所對應的值是一個 NSNumber 對象(小數)。該值改變描邊寬度(相對於字體size 的百分比)。默認爲 0,即不改變。正數只改變描邊寬度。負數同時改變文字的描邊和填充寬度。例如,對於常見的空心字,這個值一般爲3.0。
  • 11> NSShadowAttributeName(陰影)

NSShadowAttributeName(陰影)

  -   該屬性所對應的值是一個 NSShadow 對象。默認爲 nil。
  • 12> NSVerticalGlyphFormAttributeName(橫豎排版)

NSVerticalGlyphFormAttributeName(橫豎排版)

  -   該屬性所對應的值是一個 NSNumber 對象(整數)。0 表示橫排文本。1 表示豎排文本。在 iOS 中,老是使用橫排文本,0 之外的值都未定義。
相關文章
相關標籤/搜索