Chapter 26. Working with NSTextView

NSTextView is a very smart class. It is basically a word processor. It deals with fonts, justification, rulers, graphics, spell-check, undo, drag-and-drop, and copy-and-paste. We could spend days discussing the text system. For many uses of an NSTextView, however, you merely need to read data from the view and insert data into the view.

When we talk about NSTextView, we are actually talking about a whole team of objects that make NSTextView work: An NSTextStorage (which inherits from NSMutableAttributedString) tracks changes to the text and informs the NSLayoutManager. The NSLayoutManager lays out the text in a region that is defined by an NSTextContainer. The NSTextView is the view in which the text is rendered. ...

Get COCOA PROGRAMMING FOR MAC OS X SECOND EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.