Question

What is the identifier for Helvetica Neue Bold to be used in UIFont? I know that @"Helvetica Neue" is the correct identifier for Helvetica Neue, but that is it for Helvetica Neue Bold?

This is where such a font identifier would be implemented. If you try an identifier that does not find any reference, it will set the cell font to the default font and font size.

UIFont *cellFont = [UIFont fontWithName:@"Helvetica Neue" size:12.5];
Was it helpful?

Solution

HelveticaNeue-Bold is the identifier. Here is a snippet of code you can use to list all the available fonts:

NSArray *familyNames = [[NSArray alloc]initWithArray:[UIFont familyNames]];
for (NSString *familyName in familyNames) {
    NSLog(@"%@", familyName);
    NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
    for (NSString *fontName in fontNames) {
        NSLog(@"\t%@", fontName);
    }
}

*Edit: Swift 3.0

for familyName in UIFont.familyNames {
    for fontName in UIFont.fontNames(forFamilyName: familyName) {
        print("\(familyName) \(fontName)")
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top