Returns the size of the string if it were rendered with the specified constraints, including a variable font size, on a single line.
Mac Catalyst 13.0–13.0Deprecated
The font to use for computing the string size.
The minimum size to which the font may be reduced before resorting to truncation of the text.
On input, a pointer to a floating-point value. On return, this value contains the actual font size that was used to compute the size of the string.
The maximum acceptable width for the string. This value is used to calculate where line breaks would be placed.
The line break options for computing the size of the string. For a list of possible values, see NSLineBreakMode.
The width and height of the resulting string’s bounding box. These values may be rounded up to the nearest whole number.
You can use this method to obtain the layout metrics you need to draw a string in your user interface. This method does not actually draw the string or alter the receiver’s text in any way.
Although it computes where line breaks would occur, this method does not actually wrap the text to additional lines. If the entire string does not fit within the given width using the initial font size, this method reduces the font size until the string does fit or until it reaches the specified minimum font size. If it reaches the minimum font size, the method begins truncating the text (for layout purposes only) until the resulting truncated string does fit the width; it then then returns the size of that truncated string.