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 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.