3 回答

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

TA貢獻1851條經(jīng)驗 獲得超4個贊
我認為您的搜索不夠理想。
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在應用程序中使用“ ”字體,則將“ Nexa Light.otf”添加到項目中并以這種方式調(diào)用。
UIFont *fontCustom = [UIFont fontWithName:@"Nexa Light" size:14];
lblName.font = fontCustom;
- 3 回答
- 0 關注
- 657 瀏覽
添加回答
舉報