Preface |
|
xix | |
Acknowledgments |
|
xxi | |
|
Chapter 1 Cocoa: What Is It? |
|
|
1 | (10) |
|
|
1 | (2) |
|
|
3 | (1) |
|
|
4 | (1) |
|
Objects, Classes, Methods, and Messages |
|
|
5 | (1) |
|
|
6 | (1) |
|
|
7 | (1) |
|
Typographical Conventions |
|
|
7 | (1) |
|
|
8 | (1) |
|
|
8 | (3) |
|
Chapter 2 Let's Get Started |
|
|
11 | (24) |
|
|
11 | (4) |
|
|
12 | (3) |
|
|
15 | (1) |
|
|
15 | (10) |
|
|
16 | (1) |
|
|
16 | (1) |
|
|
17 | (3) |
|
|
20 | (1) |
|
|
20 | (2) |
|
|
22 | (1) |
|
|
22 | (3) |
|
|
25 | (6) |
|
Types and Constants in Objective-C |
|
|
26 | (1) |
|
|
26 | (1) |
|
Edit the Implementation File |
|
|
27 | (1) |
|
|
28 | (2) |
|
|
30 | (1) |
|
|
31 | (1) |
|
|
31 | (1) |
|
Chronology of an Application |
|
|
32 | (3) |
|
|
35 | (32) |
|
Creating and Using Instances |
|
|
35 | (2) |
|
|
37 | (11) |
|
|
41 | (2) |
|
NSObject, NSArray, NSMutableArray, and NSString |
|
|
43 | (5) |
|
"Inherits from" versus "Uses" or "Knows About" |
|
|
48 | (1) |
|
Creating Your Own Classes |
|
|
48 | (10) |
|
Creating the LotteryEntry Class |
|
|
49 | (2) |
|
|
51 | (1) |
|
Implementing a description Method |
|
|
52 | (3) |
|
|
55 | (1) |
|
Initializers with Arguments |
|
|
56 | (2) |
|
|
58 | (5) |
|
|
63 | (1) |
|
|
63 | (2) |
|
For the More Curious: How Does Messaging Work? |
|
|
65 | (1) |
|
|
66 | (1) |
|
Chapter 4 Memory Management |
|
|
67 | (16) |
|
Living with Manual Reference Counting |
|
|
69 | (8) |
|
|
70 | (2) |
|
|
72 | (1) |
|
|
73 | (3) |
|
|
76 | (1) |
|
|
77 | (3) |
|
|
80 | (3) |
|
|
81 | (1) |
|
|
81 | (1) |
|
|
82 | (1) |
|
|
83 | (16) |
|
Some Commonly Used Subclasses of NSControl |
|
|
85 | (4) |
|
|
85 | (1) |
|
|
86 | (1) |
|
|
87 | (2) |
|
Start the SpeakLine Example |
|
|
89 | (1) |
|
|
90 | (4) |
|
Making Connections in Interface Builder |
|
|
91 | (3) |
|
Implementing the SpeakLineAppDelegate Class |
|
|
94 | (2) |
|
For the More Curious: Setting the Target Programmatically |
|
|
96 | (1) |
|
|
96 | (2) |
|
|
98 | (1) |
|
|
99 | (18) |
|
|
100 | (4) |
|
The NSTableView and Its dataSource |
|
|
104 | (3) |
|
SpeakLineAppDelegate Interface File |
|
|
105 | (2) |
|
Lay Out the User Interface |
|
|
107 | (2) |
|
|
109 | (1) |
|
Edit SpeakLineAppDelegate.m |
|
|
110 | (3) |
|
Common Errors in Implementing a Delegate |
|
|
112 | (1) |
|
Many Objects Have Delegates |
|
|
112 | (1) |
|
For the More Curious: How Delegates Work |
|
|
113 | (1) |
|
Challenge: Make a Delegate |
|
|
114 | (1) |
|
Challenge: Make a Data Source |
|
|
114 | (3) |
|
Chapter 7 Key-Value Coding and Key-Value Observing |
|
|
117 | (12) |
|
|
117 | (2) |
|
|
119 | (1) |
|
|
120 | (1) |
|
|
121 | (3) |
|
|
124 | (2) |
|
|
125 | (1) |
|
For the More Curious: Key Paths |
|
|
126 | (1) |
|
For the More Curious: Key-Value Observing |
|
|
127 | (2) |
|
Chapter 8 NSArrayController |
|
|
129 | (16) |
|
Starting the RaiseMan Application |
|
|
130 | (9) |
|
|
134 | (5) |
|
|
139 | (1) |
|
|
140 | (1) |
|
For the More Curious: Sorting without NSArrayController |
|
|
141 | (1) |
|
|
142 | (1) |
|
|
142 | (3) |
|
|
145 | (14) |
|
|
145 | (1) |
|
How the NSUndoManager Works |
|
|
146 | (2) |
|
|
148 | (4) |
|
Key-Value Coding and To-Many Relationships |
|
|
148 | (4) |
|
|
152 | (1) |
|
|
153 | (3) |
|
|
156 | (2) |
|
For the More Curious: Windows and the Undo Manager |
|
|
158 | (1) |
|
|
159 | (18) |
|
|
160 | (3) |
|
|
160 | (2) |
|
|
162 | (1) |
|
The Document Architecture |
|
|
163 | (4) |
|
Info.plist and NSDocumentController |
|
|
163 | (1) |
|
|
164 | (3) |
|
|
167 | (1) |
|
Saving and NSKeyedArchiver |
|
|
167 | (1) |
|
Loading and NSKeyedUnarchiver |
|
|
168 | (2) |
|
Setting the Extension and Icon for the File Type |
|
|
170 | (2) |
|
For the More Curious: Preventing Infinite Loops |
|
|
172 | (1) |
|
For the More Curious: Creating a Protocol |
|
|
173 | (1) |
|
For the More Curious: Automatic Document Saving |
|
|
174 | (1) |
|
For the More Curious: Document-Based Applications without Undo |
|
|
175 | (1) |
|
Universal Type Identifiers |
|
|
175 | (2) |
|
Chapter 11 Basic Core Data |
|
|
177 | (16) |
|
|
177 | (2) |
|
|
179 | (14) |
|
|
180 | (3) |
|
|
183 | (6) |
|
|
189 | (2) |
|
For the More Curious: View-Based versus Cell-Based Table Views |
|
|
191 | (1) |
|
|
191 | (2) |
|
Chapter 12 NIB Files and NSWindowController |
|
|
193 | (14) |
|
|
193 | (1) |
|
Adding a Panel to the Application |
|
|
194 | (10) |
|
|
197 | (1) |
|
|
198 | (1) |
|
|
198 | (5) |
|
|
203 | (1) |
|
For the More Curious: NSBundle |
|
|
204 | (2) |
|
|
206 | (1) |
|
|
207 | (14) |
|
NSDictionary and NSMutableDictionary |
|
|
208 | (2) |
|
|
209 | (1) |
|
|
209 | (1) |
|
|
210 | (2) |
|
Precedence of Types of Defaults |
|
|
211 | (1) |
|
|
212 | (1) |
|
The Identifier for the Application |
|
|
212 | (1) |
|
Create Keys for the Names of the Defaults |
|
|
212 | (1) |
|
|
213 | (1) |
|
Letting the User Edit the Defaults |
|
|
213 | (2) |
|
|
215 | (2) |
|
Suppressing the Creation of Untitled Documents |
|
|
215 | (1) |
|
Setting the Background Color on the Table View |
|
|
216 | (1) |
|
For the More Curious: NS User Defaults Controller |
|
|
217 | (1) |
|
For the More Curious: Reading and Writing Defaults from the Command Line |
|
|
217 | (2) |
|
|
219 | (2) |
|
Chapter 14 Using Notifications |
|
|
221 | (8) |
|
What Notifications Are and Are Not |
|
|
221 | (1) |
|
What Notifications Are Not |
|
|
222 | (1) |
|
|
222 | (1) |
|
|
222 | (2) |
|
|
224 | (1) |
|
Registering as an Observer |
|
|
225 | (1) |
|
Handling the Notification When It Arrives |
|
|
226 | (1) |
|
|
226 | (1) |
|
For the More Curious: Delegates and Notifications |
|
|
227 | (1) |
|
|
228 | (1) |
|
Chapter 15 Using Alert Panels |
|
|
229 | (4) |
|
Make the User Confirm the Deletion |
|
|
230 | (2) |
|
|
232 | (1) |
|
|
233 | (8) |
|
|
234 | (2) |
|
|
236 | (3) |
|
|
237 | (1) |
|
|
238 | (1) |
|
For the More Curious: Ibtool |
|
|
239 | (1) |
|
For the More Curious: Explicit Ordering of Tokens in Format Strings |
|
|
240 | (1) |
|
|
241 | (16) |
|
|
241 | (2) |
|
Get a View to Draw Itself |
|
|
243 | (5) |
|
Create an Instance of a View Subclass |
|
|
243 | (1) |
|
|
244 | (2) |
|
|
246 | (2) |
|
Drawing with NSBezierPath |
|
|
248 | (2) |
|
|
250 | (2) |
|
Creating Views Programmatically |
|
|
252 | (1) |
|
For the More Curious: Cells |
|
|
253 | (2) |
|
For the More Curious: Isflipped |
|
|
255 | (1) |
|
|
255 | (2) |
|
Chapter 18 Images and Mouse Events |
|
|
257 | (14) |
|
|
257 | (1) |
|
|
257 | (2) |
|
|
259 | (1) |
|
|
259 | (5) |
|
|
260 | (3) |
|
|
263 | (1) |
|
Composite an Image onto Your View |
|
|
264 | (2) |
|
The View's Coordinate System |
|
|
266 | (2) |
|
|
268 | (1) |
|
For the More Curious: NSImage |
|
|
269 | (1) |
|
|
270 | (1) |
|
Chapter 19 Keyboard Events |
|
|
271 | (14) |
|
|
273 | (1) |
|
|
273 | (1) |
|
Create a New Project with a Custom View |
|
|
274 | (8) |
|
|
274 | (2) |
|
|
276 | (2) |
|
|
278 | (4) |
|
For the More Curious: Rollovers |
|
|
282 | (2) |
|
|
284 | (1) |
|
Chapter 20 Drawing Text with Attributes |
|
|
285 | (10) |
|
|
285 | (1) |
|
|
286 | (3) |
|
Drawing Strings and Attributed Strings |
|
|
289 | (1) |
|
|
289 | (2) |
|
Getting Your View to Generate PDF Data |
|
|
291 | (2) |
|
For the More Curious: NSFontManager |
|
|
293 | (1) |
|
|
293 | (1) |
|
|
294 | (1) |
|
Chapter 21 Pasteboards and Nil-Targeted Actions |
|
|
295 | (12) |
|
|
296 | (2) |
|
Add Cut, Copy, and Paste to BigLetterView |
|
|
298 | (2) |
|
|
300 | (3) |
|
|
301 | (2) |
|
For the More Curious: Which Object Sends the Action Message? |
|
|
303 | (1) |
|
For the More Curious: UTIs and the Pasteboard |
|
|
303 | (1) |
|
|
303 | (1) |
|
For the More Curious: Lazy Copying |
|
|
304 | (1) |
|
|
305 | (1) |
|
|
305 | (2) |
|
|
307 | (4) |
|
|
307 | (2) |
|
For the More Curious: Declaring Private Methods |
|
|
309 | (2) |
|
|
311 | (10) |
|
Make BigLetterView a Drag Source |
|
|
312 | (3) |
|
|
312 | (2) |
|
|
314 | (1) |
|
Make BigLetterView a Drag Destination |
|
|
315 | (4) |
|
Register For Dragged Types |
|
|
316 | (1) |
|
|
316 | (1) |
|
Implement the Dragging Destination Methods |
|
|
317 | (1) |
|
Add a Second BigLetterView |
|
|
318 | (1) |
|
For the More Curious: Operation Mask |
|
|
319 | (2) |
|
|
321 | (8) |
|
|
323 | (2) |
|
|
325 | (1) |
|
Add Code to TutorController |
|
|
326 | (2) |
|
For the More Curious: NSRunLoop |
|
|
328 | (1) |
|
|
328 | (1) |
|
|
329 | (10) |
|
|
330 | (5) |
|
|
331 | (1) |
|
|
331 | (3) |
|
|
334 | (1) |
|
For the More Curious: Contextinfo |
|
|
335 | (1) |
|
For the More Curious: Modal Windows |
|
|
336 | (3) |
|
Chapter 26 Creating NSFormatters |
|
|
339 | (14) |
|
|
341 | (6) |
|
|
341 | (1) |
|
|
342 | (2) |
|
|
344 | (1) |
|
Searching Strings for Substrings |
|
|
344 | (1) |
|
Implement the Basic Formatter Methods |
|
|
345 | (2) |
|
The Delegate of the NSControl Class |
|
|
347 | (1) |
|
|
348 | (2) |
|
Formatters That Return Attributed Strings |
|
|
350 | (1) |
|
For the More Curious: NSValueTransformer |
|
|
351 | (2) |
|
|
353 | (6) |
|
|
353 | (5) |
|
For the More Curious: Are you Drawing to the Screen? |
|
|
358 | (1) |
|
|
358 | (1) |
|
|
359 | (12) |
|
|
360 | (8) |
|
|
361 | (2) |
|
Add XML Parsing to ScheduleFetcher |
|
|
363 | (3) |
|
|
366 | (2) |
|
|
368 | (1) |
|
|
368 | (1) |
|
|
369 | (2) |
|
|
371 | (12) |
|
|
373 | (8) |
|
Memory and Objects within Blocks |
|
|
375 | (1) |
|
|
376 | (1) |
|
RanchForecast: Going Asynchronous |
|
|
376 | (1) |
|
Receiving the Asynchronous Response |
|
|
377 | (4) |
|
Challenge: Design a Delegate |
|
|
381 | (2) |
|
Chapter 30 Developing for iOS |
|
|
383 | (14) |
|
Porting RanchForecast to iOS |
|
|
383 | (3) |
|
|
386 | (1) |
|
|
386 | (2) |
|
Add a Navigation Controller |
|
|
388 | (3) |
|
|
391 | (1) |
|
|
392 | (1) |
|
|
393 | (2) |
|
|
395 | (2) |
|
|
397 | (10) |
|
|
398 | (9) |
|
Create the ManagedViewController Class |
|
|
399 | (1) |
|
Create ViewControllers and their XIB files |
|
|
400 | (1) |
|
Add View Swapping to MyDocument |
|
|
401 | (2) |
|
|
403 | (4) |
|
Chapter 32 Core Data Relationships |
|
|
407 | (10) |
|
|
407 | (2) |
|
Create Custom NSManagedObject Classes |
|
|
409 | (2) |
|
|
409 | (1) |
|
|
410 | (1) |
|
|
411 | (3) |
|
|
413 | (1) |
|
|
414 | (3) |
|
Chapter 33 Core Animation |
|
|
417 | (10) |
|
|
417 | (6) |
|
Implicit Animation and Actions |
|
|
423 | (2) |
|
|
425 | (1) |
|
|
425 | (1) |
|
|
425 | (2) |
|
|
427 | (14) |
|
|
427 | (4) |
|
A Deep Chasm Opens Before You |
|
|
428 | (1) |
|
Simple Cocoa Background Threads |
|
|
429 | (2) |
|
Improving Scattered: Time Profiling in Instruments |
|
|
431 | (4) |
|
|
431 | (4) |
|
|
435 | (3) |
|
|
435 | (2) |
|
|
437 | (1) |
|
For the More Curious: Faster Scattered |
|
|
438 | (1) |
|
|
439 | (2) |
|
Chapter 35 Cocoa and OpenGL |
|
|
441 | (10) |
|
A Simple Cocoa/OpenGL Application |
|
|
442 | (9) |
|
|
442 | (4) |
|
|
446 | (5) |
|
|
451 | (10) |
|
|
451 | (9) |
|
|
456 | (1) |
|
|
456 | (4) |
|
Challenge: .tar and .tgz files |
|
|
460 | (1) |
|
Chapter 37 Distributing Your App |
|
|
461 | (10) |
|
|
461 | (3) |
|
Preprocessor Macros and Using Build Configurations to Change Behavior |
|
|
462 | (2) |
|
|
464 | (2) |
|
|
466 | (2) |
|
|
467 | (1) |
|
Mediated File Access and Powerbox |
|
|
468 | (1) |
|
|
468 | (3) |
|
|
471 | (2) |
Index |
|
473 | |