如何在 iPhone SDK 中使用自定义字体? [英] How to use custom fonts in iPhone SDK?

查看:27
本文介绍了如何在 iPhone SDK 中使用自定义字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用中实现自定义字体.所以我在我的项目源代码中添加了它.我不想以编程方式设置.我可以通过在 xib 中设置属性来做到这一点吗?

I Want to implement custom font in my app. So i have added that in my Project Source code. I don't want to set that programatically. Is this possible that I can do this with setting properties in xib?

推荐答案

  1. 您的自定义字体添加到您的项目中,即将字体文件(CALIBRIZ_0.TTF)拖入 XCode 项目中.

  1. Add your custom font into your project , i.e. Dragged the font file(CALIBRIZ_0.TTF) into XCode project.

Edit Info.plist:添加一个带有Fonts provided by"键的新条目应用程序".

Edit Info.plist: Add a new entry with the key "Fonts provided by application".

对于您的每个文件,将文件名添加到此数组中

For each of your files, add the file name to this array

在字体簿中打开字体(在查找器中双击您的字体)以查看真正的文件名和我看到了:

Opened the font in font book(double click on your font in finder) to see what the real filename is and I see this:

现在为您的标签设置字体

yourLabel.font = [UIFont fontWithName:@"Calibri" size:15];

关注这个 获得更多

这篇关于如何在 iPhone SDK 中使用自定义字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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