Displaying a Text Container

You normally use an NSTextView object to display the text laid out in an NSTextContainer. An NSTextView can have only one NSTextContainer; however, because the two are separate objects, you can replace an NSTextView’s container to change the layout of the text it displays. You can also display an NSTextContainer’s text in any NSView by locking the graphic focus on it with lockFocus and using the NSLayoutManager methods drawBackgroundForGlyphRange:atPoint: and drawGlyphsForGlyphRange:atPoint:. If you have no need to actually display the text—if you’re only calculating line breaks or number of lines or pages, for example—you can use an NSTextContainer without an NSTextView.