A region where text is laid out.
SDKs
- iOS 7.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Frameworks
- UIKit
- App
Kit
Declaration
class NSTextContainer : NSObject
Overview
An NSLayout
uses NSText
to determine where to break lines, lay out portions of text, and so on. An NSText
object typically defines rectangular regions, but you can define exclusion paths inside the text container to create regions where text does not flow. You can also subclass to create text containers with nonrectangular regions, such as circular regions, regions with holes in them, or regions that flow alongside graphics.
Instances of the NSText
, NSLayout
, and NSText
classes can be accessed from threads other than the main thread as long as the app guarantees access from only one thread at a time.