1、将ttf文件或otf文件添加到工程中

2、在Build Phases->Copy Bundle Resources中添加资源文件

3、配置info.plist

完成以上三步字体添加就完成了
-
运行程序断点查看一下是否添加成功(未添加字体是familayNames数组中个数位75)
查看是否添加成功.png

-
使用字体时不要使用ttf或otf文件的名字,而是使用字体名字即在添加成功狗familayNames中查看到的名字
字体名字.png
-
运行结果

完成以上三步字体添加就完成了
运行程序断点查看一下是否添加成功(未添加字体是familayNames数组中个数位75)
使用字体时不要使用ttf或otf文件的名字,而是使用字体名字即在添加成功狗familayNames中查看到的名字
运行结果
本文标题:iOS 三步实现集成第三方字体(ttf或otf文件)
本文链接:https://www.haomeiwen.com/subject/pbmzzttx.html
网友评论