Name of non-system font in iPhone

人走茶凉 提交于 2019-11-30 05:28:56

问题


I want to add a non-system font to my iPhone/iPad app.

I have added the font file to the project and also added the font to the UIAppFonts property of the info.plist.

To load the font I'm using fontWithName of UIFont. But the name of the font does not seem to be the file name, with or without extension, nor the name that appears in Font Book.

UIFont* font = [UIFont fontWithName:@"What goes here?" size:10]; 

Where do I find out the name of the font?


回答1:


UIFont's +familyNames and then +fontNamesForFamilyName: should do the trick.




回答2:


If you open the ttf file in Font Book on your Mac, the title of the window is the name iOS uses too. (In my case, AvantGarde Bk BT)



来源:https://stackoverflow.com/questions/4143908/name-of-non-system-font-in-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!