UIFont+RQExtension.m 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // UIFont+RQExtension.m
  3. // RQCommon
  4. //
  5. // Created by 张嵘 on 2018/11/16.
  6. // Copyright © 2018 张嵘. All rights reserved.
  7. //
  8. /**
  9. *
  10. (
  11. "PingFangSC-Ultralight",
  12. "PingFangSC-Regular",
  13. "PingFangSC-Semibold",
  14. "PingFangSC-Thin",
  15. "PingFangSC-Light",
  16. "PingFangSC-Medium"
  17. )
  18. */
  19. /**
  20. * 极细体
  21. */
  22. static NSString *const RQPingFangSC_Ultralight = @"PingFangSC-Ultralight";
  23. /**
  24. * 常规体
  25. */
  26. static NSString *const RQPingFangSC_Regular = @"PingFangSC-Regular";
  27. /**
  28. * 中粗体
  29. */
  30. static NSString *const RQPingFangSC_Semibold = @"PingFangSC-Semibold";
  31. /**
  32. * 纤细体
  33. */
  34. static NSString *const RQPingFangSC_Thin = @"PingFangSC-Thin";
  35. /**
  36. * 细体
  37. */
  38. static NSString *const RQPingFangSC_Light = @"PingFangSC-Light";
  39. /**
  40. * 中黑体
  41. */
  42. static NSString *const RQPingFangSC_Medium = @"PingFangSC-Medium";
  43. #import "UIFont+RQExtension.h"
  44. @implementation UIFont (RQExtension)
  45. /**
  46. * 苹方极细体
  47. *
  48. * @param fontSize 字体大小
  49. *
  50. */
  51. + (instancetype)rq_fontForPingFangSC_UltralightFontOfSize:(CGFloat)fontSize {
  52. return [UIFont fontWithName:RQPingFangSC_Ultralight size:fontSize];
  53. }
  54. /**
  55. * 苹方常规体
  56. *
  57. * @param fontSize 字体大小
  58. *
  59. */
  60. + (instancetype)rq_fontForPingFangSC_RegularFontOfSize:(CGFloat)fontSize {
  61. return [UIFont fontWithName:RQPingFangSC_Regular size:fontSize];
  62. }
  63. /**
  64. * 苹方中粗体
  65. *
  66. * @param fontSize 字体大小
  67. *
  68. */
  69. + (instancetype)rq_fontForPingFangSC_SemiboldFontOfSize:(CGFloat)fontSize {
  70. return [UIFont fontWithName:RQPingFangSC_Semibold size:fontSize];
  71. }
  72. /**
  73. * 苹方纤细体
  74. *
  75. * @param fontSize 字体大小
  76. *
  77. */
  78. + (instancetype)rq_fontForPingFangSC_ThinFontOfSize:(CGFloat)fontSize {
  79. return [UIFont fontWithName:RQPingFangSC_Thin size:fontSize];
  80. }
  81. /**
  82. * 苹方细体
  83. *
  84. * @param fontSize 字体大小
  85. *
  86. */
  87. + (instancetype)rq_fontForPingFangSC_LightFontOfSize:(CGFloat)fontSize {
  88. return [UIFont fontWithName:RQPingFangSC_Light size:fontSize];
  89. }
  90. /**
  91. * 苹方中黑体
  92. *
  93. * @param fontSize 字体大小
  94. *
  95. */
  96. + (instancetype)rq_fontForPingFangSC_MediumFontOfSize:(CGFloat)fontSize {
  97. return [UIFont fontWithName:RQPingFangSC_Medium size:fontSize];
  98. }
  99. @end