Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Custom Fonts don't show up on device

I've combed SO for similar problems, and most of them seem to tell me that I've probably forgotten to add the font into the copy resources build phase. I've also made sure that both fonts are part of the build target.

I've double, and triple checked that. Both fonts are in the copy resources phase, and both are listed in the plist.

plist

In my app delegate I check which fonts I have available for their respective font families, and I'm getting unexpected results

NSLog(@"%@", [UIFont fontNamesForFamilyName:@"DS-Digital"]);
NSLog(@"%@", [UIFont fontNamesForFamilyName:@"Proxima Nova"]);

The first prints out "( "DS-Digital-Italic" )" which is what I wanted, the second prints out " ( "ProximaNova-Regular") ", also expected.

When I go to use either of the fonts as follows, it only appears in the simulator, but on any device it defaults back to system font.

[_estimateLabel setFont:[UIFont fontWithName:@"DS-Digital-Italic" size:50]];

or

[cell.mainLabel setFont:[UIFont fontWithName:@"ProximaNova-Regular" size:20]];

Is there anything I'm missing? I am using XCode 5 with an iPad mini and an iPhone 5C, both iOs 7.

like image 549
jlindenbaum Avatar asked Dec 02 '22 21:12

jlindenbaum


1 Answers

Open the font in Fontbook (It ships with your mac). Make sure you call it by the post-script name, like here: enter image description here

Its called by @"HelveticaNeueCE-Thin"

Also make sure that you checked the name of your font in "Add to targets:" when you added them to the project, if you didn't do this, they won't be copied in the app bundle sent over to your iDevice.

like image 91
Oscar Apeland Avatar answered Dec 15 '22 15:12

Oscar Apeland