1.使用自定义字体
(1)将字体文件导入项目
(2)在info.plist文件中添加 Fonts provided by application
(3)获取字体在项目中的名称
for fontFamilyName in UIFont.familyNames { print("-------------family:(fontFamilyName)") for fontName in UIFont.fontNames(forFamilyName: fontFamilyName) { print(" font:(fontName)"); } }
(4)双击打开导入的字体,获取名称
(5)获取自定义字体名称
(6)使用字体
UIFont.init(name: "SourceHanSansCN-Regular", size: fontSize)!