NSView Overview

The NSView class extends the event-handling capabilities of NSResponder to enable drawing and printing. NSView is an abstract class meaning that instances of NSView are seldom used directly. Instead, many subclasses of NSView exist to implement particular combinations of event handling and drawing behavior. Almost everything drawn in a Cocoa application is drawn by a subclass of NSView. For example, buttons, text fields, sliders, and even the backgrounds of windows are directly or indirectly subclasses of NSView. The most prominent subclasses of NSView include NSControl, NSText, NSTabView, NSSplitView, NSScrollView, and NSBox.

The NSView class cannot draw without the help of a window. When a view is drawn, it writes the data ...

Get Cocoa® Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.