如何在 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?
将您的自定义字体添加到您的项目中,即将字体文件(
CALIBRIZ_0.TTF
)拖入 XCode 项目中.
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];
关注这个 获得更多