A variety of fonts are available in iOS platform. The following code snippet shows how to list all such fonts and add the font names into an array.


Code

    // array
    NSMutableArray *fontNames = [[NSMutableArray alloc] init];
     
    // get font family
    NSArray *fontFamilyNames = [UIFont familyNames];
     
    // loop
    for (NSString *familyName in fontFamilyNames)
    {
       NSLog(@"Font Family Name = %@", familyName);
     
       // font names under family
       NSArray *names = [UIFont fontNamesForFamilyName:familyName];
     
       NSLog(@"Font Names = %@", fontNames);
     
       // add to array
       [fontNames addObjectsFromArray:names];
    }
     
    [fontNames release];