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