简体   繁体   English

如何在iOS应用中添加自定义字体?

[英]How do i add in a custom font into my iOS app?

Before Xcode updated to v7, there used to be a font which i used for my app called Heiti SC. 在Xcode更新到v7之前,曾经有一种字体用于我的应用程序Heiti SC。 After the update the font just disappeared. 更新之后,字体就消失了。 Now I have to figure out where i can download this font and how i can put it into my app. 现在,我必须弄清楚我可以在哪里下载此字体,以及如何将其放入应用程序。 Could somebody point me in the right direction? 有人能指出我正确的方向吗?

From here you can download the font http://www.free-fonts.com/heiti-tc-light .. After downloading add the folder(.ttf format) to supporting files in the project. 您可以从此处下载字体http://www.free-fonts.com/heiti-tc-light 。下载后,将文件夹(.ttf格式)添加到项目中的支持​​文件中。 Then Edit info.Plist like this 然后像这样编辑info.Plist

Fonts provided by Application take as array 应用程序提供的字体作为数组

Item 0 as Heiti SC.ttf 项目0作为Heiti SC.ttf

now you can set label.font = [UIFont fontWithName:@"Heiti SC" size:15]; 现在您可以设置label.font = [UIFont fontWithName:@“ Heiti SC” size:15];

在此处输入图片说明

In addition to the answers that have already been given here: (check this link how to add custom font ios ) 除了此处已经给出的答案之外:(请检查此链接如何添加自定义字体ios

Check the buildphase if the font has been added correctly. 检查构建阶段是否正确添加了字体。 If you don't see your font here, just drag and drop it inside. 如果您在这里看不到字体,只需将其拖放到里面即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM