Breaking News
Home / iOS / iOS Snippets / How to list all the fonts available in the iOS platform?

How to list all the fonts available in the iOS platform?

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.

  1. // array
  2. NSMutableArray *fontNames = [[NSMutableArray alloc] init];
  3.  
  4. // get font family
  5. NSArray *fontFamilyNames = [UIFont familyNames];
  6.  
  7. // loop
  8. for (NSString *familyName in fontFamilyNames)
  9. {
  10.    NSLog(@"Font Family Name = %@", familyName);
  11.  
  12.    // font names under family
  13.    NSArray *names = [UIFont fontNamesForFamilyName:familyName];
  14.  
  15.    NSLog(@"Font Names = %@", fontNames);
  16.  
  17.    // add to array
  18.    [fontNames addObjectsFromArray:names];
  19. }
  20.  
  21. [fontNames release];
[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger