uilabel custom font?

2019-06-27 09:49发布

问题:

I searched for a way to add my custom font to iphone app and I was successful in some cases. but in my case I want to import "Helvetica Condensed Black" which in the Helvetica family but it is neither mac's native nor iPhone's.

when I open the font in the finder I find a file named : "Helv Condensed" with no extension. I went through and added this file to my resources and also to plist. the same way that I did with the other font which had .tff extension and it was a successful attempt.

so question is how should I add this font which is in helvetica font family but not iphone native to my application. Also is there any way to add these fonts to interface builder?

thank you.

回答1:

You have to add it to the UIAppFonts key in your app's info.plist, and then you can use it in code, you can't add it to Interface Builder directly.

I found this post quite helpful Can I embed a custom font in an iPhone application?