自定义字体在我的应用程序中不起作用? [英] Custom font is not working in my App?

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

问题描述

在我的 iPhone 应用中,

In my iPhone app,

我已经包含了两种自定义字体,并通过stackoverflow问题引用了这个步骤......

I have included two custom fonts and by referring this steps by stackoverflow questions....

如何在 iPhone 中包含和使用新字体SDK?

并编码....

 [lbl setFont:[UIFont fontWithName:@"glyphish.ttf" size:[lbl minimumFontSize]]];

我正在为 Base SDK 5.0 构建此应用

I am building this app for Base SDK 5.0

答案是,

[lbl setFont:[UIFont fontWithName:@"glyphish" size:[lbl minimumFontSize]]];

谢谢大家.

推荐答案

您传递了一个文件名 (glyphish.ttf) 而不是实际的字体名称.最有可能的是,字体名称是 Glyphish,但您需要以某种方式查询它:使用 Mac 的Font Book.app"或通过代码:首先,您需要通过 [UIFont familyNames].然后,使用 [UIFont fontNamesForFamilyName:] 获取要加载的实际字体名称.例如,如果您的字体包含粗体变体,其系列名称将是 Glyphish,但字体名称可能是 Glyphish-Bold.

You have passed a filename (glyphish.ttf) instead of the actual font name. Most likely, the font name is Glyphish, but you need to query it somehow: either using the Mac's "Font Book.app" or via code: first, you need to query the family names via [UIFont familyNames]. Then, use [UIFont fontNamesForFamilyName:] to get the actual font names to load. For example, if your font contains a bold variant its family name would be Glyphish but font name would likely be Glyphish-Bold.

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

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