iOS UILabel字体设置

释放双眼,带上耳机,听听看~!

UIFont

一、系统字体样式

    //显示系统中所有的字体名称
NSArray *fontArr = UIFont.familyNames;
for (NSString *fontName in fontArr) {
NSLog(@"%@", fontName);
}
//可以这么调用
[UIFont fontWithName:@"PingFang TC" size:13]

打印后系统有78中字体,如下:

  1. Copperplate,
  2. Heiti SC,
  3. Apple SD Gothic Neo,
  4. Thonburi,
  5. Gill Sans,
  6. Marker Felt,
  7. Hiragino Maru Gothic ProN,
  8. Courier New,
  9. Kohinoor Telugu,
  10. Heiti TC,
  11. Avenir Next Condensed,
  12. Tamil Sangam MN,
  13. Helvetica Neue,
  14. Gurmukhi MN,
  15. Georgia,
  16. Times New Roman,
  17. Sinhala Sangam MN,
  18. Arial Rounded MT Bold,
  19. Kailasa,
  20. Kohinoor Devanagari,
  21. Kohinoor Bangla,
  22. Chalkboard SE,
  23. Apple Color Emoji,
  24. PingFang TC,
  25. Gujarati Sangam MN,
  26. Geeza Pro,
  27. Damascus,
  28. Noteworthy,
  29. Avenir,
  30. Mishafi,
  31. Academy Engraved LET,
  32. Futura,
  33. Party LET,
  34. Kannada Sangam MN,
  35. Arial Hebrew,
  36. Farah,
  37. Arial,
  38. Chalkduster,
  39. Kefa,
  40. Hoefler Text,
  41. Optima,
  42. Palatino,
  43. Malayalam Sangam MN,
  44. Al Nile,
  45. Lao Sangam MN,
  46. Bradley Hand,
  47. Hiragino Mincho ProN,
  48. PingFang HK,
  49. Helvetica,
  50. Courier,
  51. Cochin,
  52. Trebuchet MS,
  53. Devanagari Sangam MN,
  54. Oriya Sangam MN,
  55. Snell Roundhand,
  56. Zapf Dingbats,
  57. Bodoni 72,
  58. Verdana,
  59. American Typewriter,
  60. Avenir Next,
  61. Baskerville,
  62. Khmer Sangam MN,
  63. Didot,
  64. Savoye LET,
  65. Bodoni Ornaments,
  66. Symbol,
  67. Menlo,
  68. Noto Nastaliq Urdu,
  69. Bodoni 72 Smallcaps,
  70. Papyrus,
  71. Hiragino Sans,
  72. PingFang SC,
  73. Myanmar Sangam MN,
  74. Zapfino,
  75. Telugu Sangam MN,
  76. Bodoni 72 Oldstyle,
  77. Euphemia UCAS,
  78. Bangla Sangam MN

二、字体加粗效果

使用方法:[UIFont systemFontOfSize:17 weight:UIFontWeightThin];

三、UIFont常用相关属性方法

  1. fontWithSize(_:),重新设置基于当前字体的大小并返回该字体
  2. preferredFontForTextStyle(_ sytle:String),返回基于特定样式的字体
  3. systemFontOfSize(_:),systemFontOfSize:weight,返回标准IOS界面所需的字体
  4. boldSystemFontOfSize:,italicSystemFontOfSize:,返回加粗或倾斜的标准界面所需的字体
  5. familyName:,类函数,返回系统上所有的字体族

人已赞赏
iOS文章

Swift 标签(UILabel)

2020-3-29 21:33:02

iOS文章

IOS判断字典中的值是否为空

2020-3-29 22:48:01

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索