自定义字体在我的应用程序中不工作? [英] Custom font is not working in my App?
问题描述
在我的iPhone应用程序中,
In my iPhone app,
我已经包含两个自定义字体,并通过stackoverflow问题....
I have included two custom fonts and by referring this steps by stackoverflow questions....
和编码....
[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屋!