Figures, Tables, and Listings
Chapter 1
What Is Cocoa?
Figure 1-1
Cocoa in the architecture of Mac OS X
Figure 1-2
Cocoa in the architecture of iOS
Figure 1-3
The TextEdit example project in Xcode
Figure 1-4
The TextEdit Document Properties window in Interface Builder
Figure 1-5
The Interface Builder connections panel
Figure 1-6
The Instruments application
Figure 1-7
The Foundation class hierarchy
Figure 1-8
AppKit class hierarchy—Objective-C
Figure 1-9
UIKit class hierarchy
Figure 1-10
Examples of managed object contexts and the persistence stack
Figure 1-11
Application Kit class hierarchy in 1988
Table 1-1
Major classes of the AppKit and UIKit frameworks
Chapter 2
Cocoa Objects
Figure 2-1
An object’s isa pointer
Figure 2-2
Message terminology
Figure 2-3
Reachable and unreachable objects
Figure 2-4
The life cycle of an object—simplified view
Figure 2-5
Retaining a received object
Figure 2-6
Copying a received object
Figure 2-7
An autorelease pool
Figure 2-8
Initialization up the inheritance chain
Figure 2-9
Interactions of secondary and designated initializers
Figure 2-10
A simple hierarchy for number classes
Figure 2-11
A more complete number class hierarchy
Figure 2-12
Class cluster architecture applied to number classes
Figure 2-13
An object that embeds a cluster object
Table 2-1
Attributes for declared properties
Table 2-2
Important Objective-C defined types and literals
Table 2-3
Class clusters and their public superclasses
Table 2-4
Derived methods and their possible implementations
Table 2-5
Data types that can be used interchangeably between Core Foundation and Foundation
Listing 2-1
Output from a simple Cocoa tool
Listing 2-2
Cocoa code for the SimpleCocoaTool program
Listing 2-3
An example of an initializer
Listing 2-4
Secondary initializers
Listing 2-5
A typical dealloc method
Listing 2-6
A factory method for a singleton instance
Listing 2-7
Using the class and superclass methods
Listing 2-8
Using isKindOfClass:
Listing 2-9
Using respondsToSelector:
Listing 2-10
Using conformsToProtocol:
Listing 2-11
Using isEqual:
Listing 2-12
Overriding isEqual:
Listing 2-13
Returning an immutable copy of a mutable instance variable
Listing 2-14
Making a snapshot of a potentially mutable object
Listing 2-15
Strict implementation of a singleton
Chapter 3
Adding Behavior to a Cocoa Program
Figure 3-1
The main event loop in Mac OS X
Figure 3-2
Invoking a framework method that invokes an overridden method
Figure 3-3
Object composition
Figure 3-4
Where to put declarations in the interface file
Table 3-1
Lock classes
Listing 3-1
The main function for a Cocoa application in Mac OS X
Listing 3-2
The basic structure of an interface file
Listing 3-3
The basic structure of an implementation file
Listing 3-4
Initialization helper method
Listing 3-5
Implementing accessors for a scalar instance variable
Listing 3-6
Implementing accessors for an object instance variable (garbage collection enabled)
Listing 3-7
Implementing accessors for an object instance variable—good technique
Listing 3-8
Implementing accessors for an object instance variable—better technique
Listing 3-9
Lazy-loading of a resource
Chapter 4
Cocoa Design Patterns
Figure 4-1
Structure diagram for the Command pattern
Figure 4-2
The view hierarchy, visual and structural
Figure 4-3
Framework object sending a message to its delegate
Figure 4-4
View controllers in UIKit
Figure 4-5
Bouncing KVO updates to the main operation queue
Figure 4-6
Traditional version of MVC as a compound pattern
Figure 4-7
Cocoa version of MVC as a compound design pattern
Figure 4-8
Coordinating controller as the owner of a nib file
Figure 4-9
Employee management application object diagram
Figure 4-10
Employees table view
Figure 4-11
Relationships in the employee management application
Figure 4-12
Relationship cardinality
Figure 4-13
Object graph for the employee management application
Figure 4-14
Employees table view showing department name
Listing 4-1
Declaring the receptionist class
Listing 4-2
The class factory method for creating a receptionist object
Listing 4-3
Handling the KVO notification
Listing 4-4
Creating a receptionist object
Chapter 5
Communicating with Objects
Figure 5-1
The mechanism of delegation
Figure 5-2
A more realistic sequence involving a delegate
Figure 5-3
How the target-action mechanism works in the control-cell architecture
Figure 5-4
Bindings between view, controller, and model objects
Figure 5-5
Establishing a binding in Interface Builder
Figure 5-6
Posting and broadcasting a notification
Figure 5-7
A notification queue and notification center
Listing 5-1
Sample delegation methods with return values
Listing 5-2
Sample delegation methods returning void