Returns the bounding rectangle required to draw the string.
- iOS 6.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The width and height constraints to apply when computing the string’s bounding rectangle.
Additional drawing options to apply to the string during rendering. For a list of possible values, see
A context object with information about how to adjust the font tracking and scaling information. On return, the specified object contains information about the actual values used to render the string. This parameter may be
A rectangle whose size component indicates the width and height required to draw the entire contents of the string.
You can use this method to compute the space required to draw the string. The constraints you specify in the size parameter are a guide for the renderer for how to size the string. However, the actual bounding rectangle returned by this method can be larger than the constraints if additional space is needed to render the entire string. Typically, the renderer preserves the width constraint and adjusts the height constraint as needed.
In iOS 7 and later, this method returns fractional sizes (in the
size component of the returned rectangle); to use a returned size to size views, you must use raise its value to the nearest higher integer using the
To calculate the bounding rectangle, this method uses the baseline origin by default, so it behaves as a single line. To render the string in multiple lines, specify