List of All the Available Fonts on iPhone


Apple intruduced the UIFont class from iOS 2.0.  The UIFont class provides the interface for getting and setting font information. Till the iOS 7 there are total 235 fonts available. Font objects are immutable and so it is safe to use them from multiple threads in your app.

Following snippet of code will be useful to list down all the available fonts in iOS .

- (void)getAllFonts {

    NSArray *familyNames = [UIFont familyNames];
    NSArray *fontNames;
    int totalAvailableFonts = 0;

    for (NSString *familyName in familyNames) {
        NSLog(@"Family name: %s", [familyName UTF8String]);
        fontNames = [UIFont fontNamesForFamilyName:familyName];
        for (NSString *fontName in fontNames) {
            NSLog(@"\tFont name: %s", [fontName UTF8String]);
            totalAvailableFonts ++;
        }
    }

    NSLog(@"Total Fonts are %d",totalAvailableFonts);
}

Click here to check list of all fonts

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s