Type Method

fontWithDescriptor:size:

Returns a font matching the given font descriptor.

Declaration

+ (UIFont *)fontWithDescriptor:(UIFontDescriptor *)descriptor size:(CGFloat)pointSize;

Parameters

descriptor

The font descriptor to match.

pointSize

The size in points to which the font is scaled. If greater than 0.0, it has precedence over UIFontDescriptorSizeAttribute in descriptor.

Return Value

A font object for the specified descriptor and size.

Discussion

In most cases, you can simply use fontWithName:size: to create standard scaled fonts.

See Also

Creating Fonts

preferredFontForTextStyle:

Returns an instance of the system font for the specified text style and scaled appropriately for the user's selected content size category.

preferredFontForTextStyle:compatibleWithTraitCollection:

Returns an instance of the system font for the appropriate text style and traits.

Getting a Scaled Font

Scale text in your interface automatically by creating fonts that support Dynamic Type.

Creating Self-Sizing Table View Cells

Create table view cells that support Dynamic Type and use system spacing constraints to adjust the spacing surrounding text labels.

fontWithName:size:

Creates and returns a font object for the specified font name and size.

fontWithSize:

Returns a font object that is the same as the receiver but which has the specified size instead.