I am trying to set a label to a custom font with the following code.
cell.lblDataum.font = [UIFont fontWithName:@"Homenaje_Regular" size:10.0];
I’v added this font in my .plist.
<key>UIAppFonts</key>
<array>
<string>Homenaje_Regular.ttf</string>
</array>
But still no succes. Can anybody help me?
Kind regards
Homenaje_Regular.ttffile to your Xcode project and added it to your target’s Copy File Build Rule (checkbox is checked next to the target name in the Inspector Panel?) so that the TTF file is copied into the application bundle on compilation.@"Homenaje_Regular". You have to use the real font name as a parameter forfontWithName:and that’s not always the same as the file name.In your case, the real name of your font is probably
"Homenaje-Regular"or just"Homenaje"and not"Homenaje_Regular".You can have the real name of the font by opening your font in FontBook on your Mac and simply press Cmd-I to get that information.
You can also list by code in your iOS app all the fonts available to make sure your font is correctly detected by your app and pick up the right name of your custom font to use with
fontWithName::