5

I'm looking for an official list of available Fonts on iOS 4.2 since Apple included more fonts with the 4.2 update.

Unfortunately, I can't seem to find anything in the main documentation, nor on Apple's developer site; but I faintly remember that somewhere I saw an "official", that is, a list made by Apple of all fonts available on iOS.

If someone could point me to a piece of documentation, that would be nice. :)

Thanks in advance!

Update:

Found an app called "Fonts" on the App Store (free). It simply displays all fonts on the device.

2

1 Answer 1

2

You can check the available font for your device (iPhone or iPad) using this method

- (void)getAllFonts{
   NSArray *fontFamilies =[UIFont familyNames];

   for(int i =0; i <[fontFamilies count]; i++){
       NSString *fontFamily =[fontFamilies objectAtIndex:i];
       NSArray *fontNames =[UIFont fontNamesForFamilyName:[fontFamilies objectAtIndex:i]];
       NSLog(@"%@: %@", fontFamily, fontNames);
   }
}

Copy/paste this on a class and use [self getAllFonts];

The list should be displayed on your logs

EDIT: If you wanted to see what it looks like, how about we use a table view

STEP1: Add this to your header

@interface FontViewController (){
    NSArray* fontFamilies;
}

STEP2: On your interface file (.m), populate your array on viewDidLoad.

-(void)viewDidLoad{
    fontFamilies = [UIFont familyNames];
}

STEP3: Finally, add this to you cellForRowAtIndexPath method

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    // The Magic :)    
    cell.textLabel.text = [fontFamilies objectAtIndex:indexPath.row];
    cell.textLabel.font = [UIFont fontWithName:[fontFamilies objectAtIndex:indexPath.row] size:12];

    return cell;
}

PS: Make sure you got the delegate and datasource connected. Your tableView Cell property on your storyboard (or xib) should be "Cell", And make sure that:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return fontFamilies.count;
}

For more info on table views, check the apple documentation here

or see appCoda's Table View tutorial here

2
  • Thanks, although you don't see what the fonts look like this way.
    – BastiBen
    Nov 6, 2013 at 10:16
  • Editted. Sorry for the long post, but that should show you what each font looks like :) Cheers
    – aalesano
    Nov 9, 2013 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.