Last Updated: February 25, 2016
·
678
· bontojr

List available fonts in iOS

Here's an helper method to list available fonts inside an iOS app:

- (void)listAvailableFonts
            {
                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]);
                    }
                }
            }

I usually use it inside didFinishLaunchingWithOptions:.