Skip to content

Instantly share code, notes, and snippets.

@nomatteus
Last active December 11, 2015 04:39
Show Gist options
  • Save nomatteus/4546816 to your computer and use it in GitHub Desktop.
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).
// 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