How to create a font with +fontWithName:size: and specify both the font family name and the specific style information for the font?

ios, ipad, iphone, uifont

Solution

See this answer for naming scheme. Full font list (with names) can be found here.

Example:

[UIFont fontWithName:@"HelveticaNeue-Bold" size:15.0];

Update

iOS 8.2 added this method for fetching system fonts of different weights.

Example:

[UIFont systemFontOfSize:15.0 weight:UIFontWeightBold];

Problem

The docs say: ``` + (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize ``` The fully specified name of the font. This name incorporates both the font family name and the specific style information for the font. The examples I find only specify a font name. But I want to specify other attributes as well such as medium font weight etc. How is this encoded into the name?

Original source

Related problems