iOS基礎 - 文本屬性Attributes

  1. NSKernAttributeName: 調整字句 kerning 字句調整
  2. NSFontAttributeName : [UIFont systemFontOfSize:_fontSize] 設置字體
  3. NSForegroundColorAttributeName :[UIColor redColor] 設置文字顏色
  4. NSParagraphStyleAttributeName : paragraph 設置段落樣式
  5. NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
  6. paragraph.alignment = NSTextAlignmentCenter;
  7. NSBackgroundColorAttributeName: [UIColor blackColor] 設置背景顏色
  8. NSStrokeColorAttributeName設置文字描邊顏色,須要和NSStrokeWidthAttributeName設置描邊寬度,這樣就能使文字空心.
  9. NSStrokeWidthAttributeName這個屬性所對應的值是一個 NSNumber 對象(小數)。該值改變描邊寬度(相對於字體size 的百分比)。默認爲 0,即不改變。正數只改變描邊寬度。負數同時改變文字的描邊和填充寬度。同時設置了空心的兩個屬性,而且NSStrokeWidthAttributeName屬性設置爲整數,文字前景色就無效果了
  10. NSStrikethroughStyleAttributeName 添加刪除線
  11. NSUnderlineStyleAttributeName 添加下劃線 
  12. NSShadowAttributeName 設置陰影,單獨設置很差使,必須和其餘屬性搭配纔好使。和這三個任一個都好使,NSVerticalGlyphFormAttributeName,NSObliquenessAttributeName,NSExpansionAttributeName
  13. NSVerticalGlyphFormAttributeName該屬性所對應的值是一個 NSNumber 對象(整數)表示橫排文本。表示豎排文本。在 iOS 中,老是使用橫排文本,之外的值都未定義。
  14. NSObliquenessAttributeName設置字體傾斜
  15. NSExpansionAttributeName 設置文本扁平化
相關文章
相關標籤/搜索