The interface for getting and setting font information.
SDKs
- iOS 2.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- UIKit
Declaration
@interface UIFont : NSObject
Overview
UIFont
provides you with access to the font’s characteristics and also provides the system with access to the font’s glyph information, which is used during layout. You use font objects by passing them to methods that accept them as a parameter.
You do not create font objects using the alloc
and init
methods. Instead, you use class methods of UIFont
, such as preferred
, to look up and retrieve the desired font object. These methods check for an existing font object with the specified characteristics and return it if it exists. Otherwise, they create a new font object based on the desired font characteristics.
Font objects are immutable and so it is safe to use them from multiple threads in your app.