Draws the attributed string inside the specified bounding rectangle.
- iOS 7.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The bounding rectangle in which to draw the string. In AppKit, the origin of the bounding box is normally in the lower-left corner, but the origin is in the upper-left corner if the focused view is flipped.
The text attributes with which to draw the string. These are the same attributes that can be applied to an
NSAttributedobject, but in the case of
NSStringobjects, the attributes apply to the entire string, rather than ranges within the string.
This method draws as much of the string as it can inside the specified rectangle, wrapping the string text as needed to make it fit. If the string is too long to fit inside the rectangle, the method renders as much as possible and clips the rest.
If newline characters are present in the string, those characters are honored and cause subsequent text to be placed on the next line underneath the starting point.
There must be either a focused view or an active graphics context when you call this method.