将自定义字体添加到我的iPhone应用程序 [英] Adding custom fonts to my iphone application

查看:200
本文介绍了将自定义字体添加到我的iPhone应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的iPhone应用程序中使用自定义字体。在做了一些研究后,我发现你可以添加一个自定义的字体到你的包中。所以我把digreadout2.ttf这个字体复制到了我的应用程序文件夹中,并在.plist文件中添加了一个关键字。使用确切的文件名,包括扩展名。然后我创建UIFont对象,并将其分配给我的UILabel的字体属性。现在的问题是,当我运行我的应用程序,它给了我一个错误,说:FT_Open_Face失败:错误2.

如果有人有什么我可以尝试的建议



谢谢

解决方案

我发现错误。基本上发生了什么是我用我的字体文件有一个空白的文件名。所以,当我试图加载它在plist文件中,它给了错误的文件没有找到,一旦我删除空间的文件名一切工作完美。


I want to use a custom font in my iPhone app. After doing some research I found that you can add a custom font to your package. So I copied the font, which is digreadout2.ttf to my app folder and added a key in the .plist file. using the exact filename including the extension. I then create the UIFont object and assign it to the font property of my UILabel. Now the problem is that when I run my app it gives me an error saying : FT_Open_Face failed: error 2.

If anyone has any suggestions of what I can try it will be very helpful.

Thanks

解决方案

Thanks for the response, I found the error. Basically what happened was that the file I used for my font had a white space in the file name. So when I tried to load it in the plist file it gave the error of file not found, once I removed the space out of the filename everything worked perfecty.

这篇关于将自定义字体添加到我的iPhone应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆