Returns the bounding rectangle for the glyphs laid out in the given text container.
SDKs
- iOS 7.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Frameworks
- UIKit
- App
Kit
Declaration
func usedRect(for container: NSText Container) -> CGRect
func usedRect(for container: NSText Container) -> NSRect
Discussion
Returns the text container's currently used area, which determines the size that the view would need to be in order to display all the glyphs that are currently laid out in the container. This causes neither glyph generation nor layout.
Used rectangles are always in container coordinates.