Introduction to Control and Cell Programming Topics for Cocoa

Explains the relationship between Cocoa control and cell objects.

Organization of This Document

Controls and cells implement user-interface objects, like buttons, text fields, and sliders. The control is responsible for

  • Displaying itself
  • Intercepting user events (such as a clicking a button or moving a slider)
  • Sending actions to other objects, usually in response to a user event (such as changing a variable’s value as a slider moves or performing a command when a button is pressed.)

A control usually delegates the first two responsibilities to cells. Splitting these responsibilities off makes it easier to create a control with many identical elements (like a spreadsheet table) or with a few different elements (like a pull-down list that lets you enter a string either in a text field or from a menu of pre-elected strings).

Here are the concepts:

  • About Cells and Controls gives basic information on what the NSCell and NSControl classes do.
  • How Controls and Cells Interact gives more information on how controls and cells interact and how they operate.
  • Cell States describes the three states a control can have: on, off, or mixed. Although used primarily by NSButton, states are defined in NSCell so future subclasses can use them.
  • Represented Objects explains how to associate a cell with the object it represents.

Here are the tasks:

Next

Copyright © 2008 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2008-10-15