問題描述
在我的 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
.
這篇關于自定義字體在我的應用程序中不起作用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!