boundingRect(with:options:attributes:)
Calculates and returns the bounding rect for the receiver drawn using the given options and display characteristics, within the specified rectangle in the current graphics context.
Declaration
func boundingRect(with size: NSSize, options: NSString.DrawingOptions = [], attributes: [NSAttributedString.Key : Any]? = nil) -> NSRectParameters
- size:
The size of the rectangle to draw in.
- options:
String drawing options.
- attributes:
A dictionary of text attributes to be applied to the string. These are the same attributes that can be applied to an
NSAttributedStringobject, but in the case ofNSStringobjects, the attributes apply to the entire string, rather than ranges within the string.
Return Value
The bounding rect for the receiver drawn using the given options and display characteristics. The rect origin returned from this method is the first glyph origin.
Discussion
This method works in single-line, baseline rendering configuration by default. If the string drawing option NSStringDrawingUsesLineFragmentOrigin is specified, the method behaves in multiline configuration.
See Also
Deprecated
string(withCString:)init(CString:)string(withCString:length:)init(CString:length:)init(CStringNoCopy:length:freeWhenDone:)string(withContentsOfFile:)init(contentsOfFile:)string(withContentsOf:)init(contentsOfURL:)write(toFile:atomically:)write(to:atomically:)getCharacters(_:)cString()lossyCString()cStringLength()