You can draw string objects directly in a focused
NSView using methods such as
drawAtPoint:withAttributes: (to draw a string with multiple attributes, such as multiple text fonts, you must use an
NSAttributedString object). These methods are described briefly in “Text” in Cocoa Drawing Guide.
The simple methods, however, are designed for drawing small amounts of text or text that is only drawn rarely—they create and dispose of various supporting objects every time you call them. To draw strings repeatedly, it is more efficient to use
NSLayoutManager, as described in “Drawing Strings”. For an overview of the Cocoa text system, of which
NSLayoutManager is a part, see Cocoa Text Architecture Guide.
© 1997, 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-12-13)