Last active
December 11, 2015 04:39
-
-
Save nomatteus/4546816 to your computer and use it in GitHub Desktop.
List all font names (useful for finding the font name of custom fonts added to project).
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
// TTF or OTF fonts are supported. | |
// Drag font into project, and copy into target. | |
// Add this to [App]-Info.plist: "Fonts provided by application" | |
// Add all font filenames to this property (i.e. "my_font.ttf" or "fontName.otf") | |
// Use font in your code! (Get the name using the code below; it won't always be the same as the filename.) | |
// Lists all font names | |
for ( NSString *familyName in [UIFont familyNames] ) { | |
NSLog(@"Family %@", familyName); | |
NSLog(@"Names = %@", [UIFont fontNamesForFamilyName:familyName]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment