Last active
August 29, 2015 14:01
-
-
Save GuillaumeJasmin/a8f66f3ae35bc580c302 to your computer and use it in GitHub Desktop.
Add custom font in iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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