Table 1-1  Major classes of the AppKit and UIKit frameworks

Classes

Comparison

NSApplication

UIApplication

The classes are strikingly similar in their primary roles. They provide a singleton object that sets up the application’s display environment and event loop, distributes events, and notifies a delegate when application-specific events occur (such as launch and termination). However, the NSApplication class performs functions (for example, managing application suspension, reactivation, and hiding) that are not available to an iOS application.

NSResponder

UIResponder

These classes also have nearly identical roles. They are abstract classes that define an interface for responding to events and managing the responder chain. The main difference is that the NSResponder event-handling methods are defined for the mouse and keyboard, whereas the UIResponder methods are defined for the Multi-Touch event model.

NSWindow

UIWindow

The UIWindow class occupies a place in the class hierarchy different from the place NSWindow occupies in AppKit; it is a subclass of UIView, whereas the AppKit class inherits directly from NSResponder. UIWindow has a much more restricted role in an application than does NSWindow. It also provides an area for displaying views, dispatches events to those views, and converts between window and view coordinates.

NSView

UIView

These classes are very similar in purpose and in their basic sets of methods. They allow you to move and resize views, manage the view hierarchy, draw view content, and convert view coordinates. The design of UIView, however, makes view objects inherently capable of animation.

NSControl

UIControl

Both classes define a mechanism for objects such as buttons and sliders so that, when manipulated, the control object sends an action message to a target object. The classes implement the target-action mechanism in different ways, largely because of the difference between event models. See “The Target-Action Mechanism” for information.

NSViewController

UIViewController

The role of both of these classes is, as their names suggest, to manage views. How they accomplish this task is different. The management provided by an NSViewController object is dependent on bindings, which is a technology supported only in Mac OS X. UIViewController objects are used in the iOS application model for modal and navigation user interfaces (for example, the views controlled by navigation bars).

NSTableView

UITableView

NSTableView inherits from NSControl, but UITableView does not inherit from UIControl. More importantly, NSTableView objects support multiple columns of data; UITableView objects display only a single column of data at a time, and thus function more as lists than presentations of tabular data.