Skip to content

Instantly share code, notes, and snippets.

@GuillaumeJasmin
Last active August 29, 2015 14:01
Show Gist options
  • Save GuillaumeJasmin/a8f66f3ae35bc580c302 to your computer and use it in GitHub Desktop.
Save GuillaumeJasmin/a8f66f3ae35bc580c302 to your computer and use it in GitHub Desktop.
Add custom font in iOS
/**
* Add font to project. In the right side, in "Target Membership", check your project.
* In infos.plist, add "Fonts provided by application" (array), and each item is the font file's name
*/
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
for (indFont=0; indFont<[fontNames count]; ++indFont)
{
NSLog(@" Font name: %@", [fontNames objectAtIndex:indFont]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment