Contents

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 article expects that a developer is familiar with the Cocoa event model described in Cocoa Event Handling Guide as well as the graphics drawing environment described in Cocoa Drawing Guide.

Organization of This Document

View Programming Guide for Cocoa consists of the following chapters:

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:

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 implements a “joystick” user interface item that illustrates a bindings-enabled subclass of NSView.
  • ColorSampler demonstrates using lockFocus to read pixel colors from a view.
  • Reducer demonstrates use of Core Image, the NSAnimation class, and view drawing redirection. Includes a collapsible NSView subclass that is Cocoa bindings-enabled.

Next

Copyright © 2013 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2013-08-08