Type Method

monospacedDigitSystemFont(ofSize:weight:)

Returns the font object used for standard interface items that require fixed distances between digits.

Declaration

class func monospacedDigitSystemFont(ofSize fontSize: CGFloat, weight: UIFont.Weight) -> UIFont

Parameters

fontSize

The size (in points) for the font. This value must be greater than 0.0.

weight

The weight of the font, specified as a font weight constant. For a list of possible values, see "Font Weights” in UIFontDescriptor. Avoid passing an arbitrary floating-point number for weight, because a font might not include a variant for every weight.

Return Value

A font object of the specified size and weight.

Discussion

In iOS 9 and later, the system font uses proportional spacing. When displaying numerical data, you can use this method to retrieve a monospace font for displaying that data. With a monospaced font, each digit occupies the same amount of space, which makes it easier to read numbers that are stacked vertically.

See Also

Creating System Fonts

class func systemFont(ofSize: CGFloat) -> UIFont

Returns the font object used for standard interface items in the specified size.

class func systemFont(ofSize: CGFloat, weight: UIFont.Weight) -> UIFont

Returns the font object used for standard interface items in the specified size and weight.

class func boldSystemFont(ofSize: CGFloat) -> UIFont

Returns the font object used for standard interface items that are rendered in boldface type in the specified size.

class func italicSystemFont(ofSize: CGFloat) -> UIFont

Returns the font object used for standard interface items that are rendered in italic type in the specified size.