3 回答

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
將自定義字體添加到項(xiàng)目中,即將字體文件(
CALIBRIZ_0.TTF
)拖入XCode項(xiàng)目中。編輯Info.plist:使用鍵“應(yīng)用程序提供的字體”添加一個(gè)新條目。
對于每個(gè)文件,將文件名添加到此數(shù)組
打開字體書中的字體(在finder中雙擊您的字體)以查看真正的文件名,我看到了:
現(xiàn)在將字體設(shè)置為標(biāo)簽
yourLabel.font = [UIFont fontWithName:@"Calibri" size:15];
跟隨這個(gè)獲得更多

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個(gè)贊
我認(rèn)為您的搜索不夠理想。
How to add CUSTOM fonts:-
Steps:-
1. Add your custom font files into your project using XCode as a resource
2. Add a key to your info.plist file called "Fonts provided by application".
3. Make this key an array
4. For each font you have, enter the full name of your font file (including the extension) as items to theUIAppFonts array
5. Save info.plist
6. Now call UIFont *fontCustom = [UIFont fontWithName:@"CustomFontName" size:12]; to get the custom fonts.
注意:-確保字體在您的副本捆綁資源中。
例如:-如果要Nexa Light在應(yīng)用程序中使用“ ”字體,則將“ Nexa Light.otf”添加到項(xiàng)目中并以這種方式調(diào)用。
UIFont *fontCustom = [UIFont fontWithName:@"Nexa Light" size:14];
lblName.font = fontCustom;
- 3 回答
- 0 關(guān)注
- 645 瀏覽
添加回答
舉報(bào)