---
title: Introduction to View Programming Guide for Cocoa
framework: cocoa
role: article
path: apple-archive/documentation/Cocoa/Conceptual/CocoaViewsGuide/Introduction
---

# Introduction to View Programming Guide for Cocoa

Explains how to design and implement Cocoa views in applications.

## Who Should Read This Document

You should read this document to gain an understanding of working with views in a Cocoa application. You are expected to be familiar with Cocoa development, including the Objective-C language and memory management. The [Creating a Custom View](../SubclassingNSView/SubclassingNSView.html#//apple_ref/doc/uid/TP40002978-CH7-SW4) article expects that a developer is familiar with the Cocoa event model described in *[Cocoa Event Handling Guide](../../EventOverview/Introduction/Introduction.html#//apple_ref/doc/uid/10000060i)* as well as the graphics drawing environment described in *[Cocoa Drawing Guide](../../CocoaDrawingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40003290)*.

## Organization of This Document

*View Programming Guide for Cocoa* consists of the following chapters:

- [What Are Views?](../WhatAreViews/WhatAreViews.html#//apple_ref/doc/uid/TP40002978-CH5-SW1) describes the role of the view in Cocoa applications and an overview of the views provided by Cocoa. - [View Geometry](../Coordinates/Coordinates.html#//apple_ref/doc/uid/TP40002978-CH10-SW1) describes how views establish their base coordinate system. - [Working with the View Hierarchy](../WorkingWithAViewHierarchy/WorkingWithAViewHierarchy.html#//apple_ref/doc/uid/TP40002978-CH4-SW1) describes how an application inserts and removes views from the view hierarchy. - [Creating a Custom View](../SubclassingNSView/SubclassingNSView.html#//apple_ref/doc/uid/TP40002978-CH7-SW4) describes the various aspects of `NSView` that an application can subclass, and provides a dissection of a custom `NSView` subclass. - [Advanced Custom View Tasks](../AdvancedSubclassing/AdvancedSubclassing.html#//apple_ref/doc/uid/TP40002978-CH12-SW4) describes the advanced view subclass drawing tasks. - [Optimizing View Drawing](../Optimizing/Optimizing.html#//apple_ref/doc/uid/TP40002978-CH11-SW1) describes techniques to optimize view drawing.

## See Also

There are other technologies, not fully covered in this document, that are fundamental to using views in your application. Refer to these documents for more details:

- *[Cocoa Event Handling Guide](../../EventOverview/Introduction/Introduction.html#//apple_ref/doc/uid/10000060i)* describes the event model used by Cocoa applications and explains how your objects can handle events and participate in the responder chain. - *[Cocoa Drawing Guide](../../CocoaDrawingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40003290)* describes the basic methods used to draw curves, fill shapes, and modify the coordinate system. - *[Drag and Drop Programming Topics](../../DragandDrop/DragandDrop.html#//apple_ref/doc/uid/10000069i)* describes how to implement drag and drop in a view subclass.

There is also sample code available that provides detailed examples of view usage. The following sample code is installed in `/Developer/Examples/Appkit`:

- DotView is a simple application that implements a basic `NSView` subclass. - Sketch is a scriptable graphics application. It provides a look at a complex view subclass than handles many types of events. - Worm provides three several different `NSView` implementations that demonstrate techniques for improving a view's performance.

Additional sample code is available through Apple Developer Connection:

- [Bindings Joystick](http://developer.apple.com/samplecode/BindingsJoystick/index.html) implements a “joystick” user interface item that illustrates a bindings-enabled subclass of `NSView`. - [ColorSampler](http://developer.apple.com/samplecode/Color_Sampler/index.html) demonstrates using `lockFocus` to read pixel colors from a view. - [Reducer](http://developer.apple.com/samplecode/Reducer/index.html) demonstrates use of Core Image, the `NSAnimation` class, and view drawing redirection. Includes a collapsible `NSView` subclass that is Cocoa bindings-enabled.

[Next](../WhatAreViews/WhatAreViews.html)

Copyright © 2013 Apple Inc. All Rights Reserved. [Terms of Use](http://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](http://www.apple.com/privacy/) | Updated: 2013-08-08
