|
|
xvii | |
|
|
xxiii | |
Preface |
|
xxv | |
|
|
1 | (76) |
|
|
3 | (14) |
|
1.1 Understanding When to Use Cocoa |
|
|
3 | (6) |
|
|
3 | (2) |
|
|
5 | (1) |
|
|
5 | (2) |
|
|
7 | (1) |
|
|
8 | (1) |
|
1.2 Understanding Cocoa's Role in Mac OS X |
|
|
9 | (7) |
|
|
9 | (2) |
|
|
11 | (2) |
|
|
13 | (1) |
|
|
14 | (1) |
|
|
15 | (1) |
|
|
16 | (1) |
|
|
17 | (10) |
|
|
17 | (2) |
|
|
19 | (5) |
|
2.2.1 Objective-C Compiler Choices |
|
|
20 | (2) |
|
2.2.2 Differences from Java and C++ |
|
|
22 | (1) |
|
|
23 | (1) |
|
|
24 | (1) |
|
|
25 | (2) |
|
3 Using Apple's Developer Tools |
|
|
27 | (50) |
|
3.1 Obtaining Apple's Developer Tools |
|
|
28 | (1) |
|
|
28 | (9) |
|
3.2.1 Outlets and Actions |
|
|
30 | (1) |
|
|
31 | (3) |
|
3.2.3 Drawing a Simple Application |
|
|
34 | (3) |
|
|
37 | (6) |
|
3.3.1 Creating a Simple Project |
|
|
37 | (2) |
|
|
39 | (2) |
|
|
41 | (1) |
|
3.3.4 Building Without XCode |
|
|
42 | (1) |
|
|
43 | (23) |
|
3.4.1 Why Learn Objective-C? |
|
|
44 | (1) |
|
|
44 | (8) |
|
3.4.3 Exceptions and Synchronization |
|
|
52 | (3) |
|
|
55 | (3) |
|
|
58 | (2) |
|
|
60 | (3) |
|
|
63 | (3) |
|
|
66 | (1) |
|
|
66 | (8) |
|
|
66 | (4) |
|
|
70 | (2) |
|
3.5.3 Constructors and Initializers |
|
|
72 | (2) |
|
|
74 | (3) |
|
|
77 | (208) |
|
4 Foundation: The Objective-C Standard Library |
|
|
79 | (54) |
|
|
79 | (6) |
|
|
80 | (1) |
|
|
80 | (5) |
|
4.2 Core Foundation Types |
|
|
85 | (1) |
|
|
85 | (8) |
|
|
86 | (1) |
|
|
87 | (1) |
|
4.3.3 Boxed Numbers and Values |
|
|
88 | (2) |
|
|
90 | (1) |
|
4.3.5 Caches and Discardable Data |
|
|
90 | (1) |
|
|
91 | (2) |
|
|
93 | (7) |
|
4.4.1 Comparisons and Ordering |
|
|
93 | (3) |
|
4.4.2 Primitive Collections |
|
|
96 | (1) |
|
|
97 | (1) |
|
|
98 | (1) |
|
|
99 | (1) |
|
|
100 | (11) |
|
4.5.1 Enumeration with Higher-Order Messaging |
|
|
101 | (3) |
|
4.5.2 Enumerating with Blocks |
|
|
104 | (1) |
|
4.5.3 Supporting Fast Enumeration |
|
|
105 | (6) |
|
|
111 | (6) |
|
|
112 | (2) |
|
|
114 | (3) |
|
4.7 Interacting with the Filesystem |
|
|
117 | (7) |
|
|
117 | (3) |
|
4.7.2 Workspace and File Management |
|
|
120 | (2) |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
124 | (8) |
|
4.8.1 Requesting Notifications |
|
|
125 | (1) |
|
4.8.2 Sending Notifications |
|
|
126 | (1) |
|
4.8.3 Sending Asynchronous Notification |
|
|
127 | (3) |
|
4.8.4 Distributed Notifications |
|
|
130 | (2) |
|
|
132 | (1) |
|
|
133 | (26) |
|
|
133 | (7) |
|
5.2 Applications and Delegates |
|
|
140 | (2) |
|
|
142 | (5) |
|
|
142 | (4) |
|
5.3.2 Targets and Actions |
|
|
146 | (1) |
|
5.3.3 Becoming First Responder |
|
|
147 | (1) |
|
5.4 Run Loops in Applications |
|
|
147 | (4) |
|
5.5 Delegates and Notifications |
|
|
151 | (3) |
|
|
154 | (3) |
|
|
154 | (1) |
|
|
155 | (1) |
|
|
156 | (1) |
|
|
157 | (2) |
|
6 Creating Graphical User Interfaces |
|
|
159 | (44) |
|
|
159 | (5) |
|
|
164 | (5) |
|
|
164 | (1) |
|
|
165 | (1) |
|
|
166 | (1) |
|
|
167 | (2) |
|
|
169 | (1) |
|
|
169 | (15) |
|
|
170 | (2) |
|
|
172 | (1) |
|
|
172 | (9) |
|
|
181 | (3) |
|
|
184 | (18) |
|
|
185 | (5) |
|
6.4.2 Key-Value Observing |
|
|
190 | (3) |
|
|
193 | (1) |
|
6.4.4 Generic Controllers |
|
|
194 | (1) |
|
6.4.5 Bindings and User Defaults |
|
|
195 | (1) |
|
6.4.6 Using Bindings in Interface Builder |
|
|
196 | (6) |
|
|
202 | (1) |
|
|
203 | (42) |
|
7.1 Understanding Windows |
|
|
204 | (4) |
|
|
207 | (1) |
|
|
208 | (1) |
|
7.3 Creating Window Objects |
|
|
208 | (11) |
|
|
210 | (2) |
|
|
212 | (2) |
|
7.3.3 Understanding Window Controllers |
|
|
214 | (1) |
|
7.3.4 Creating a Simple Window Factory |
|
|
214 | (4) |
|
7.3.5 Saving a Window's Position |
|
|
218 | (1) |
|
|
219 | (4) |
|
7.4.1 Displaying Standard Palettes |
|
|
220 | (3) |
|
|
223 | (6) |
|
|
223 | (1) |
|
7.5.2 Showing Standard Sheets |
|
|
224 | (5) |
|
|
229 | (3) |
|
|
232 | (11) |
|
7.7.1 The Structure of a Menu |
|
|
232 | (2) |
|
7.7.2 Populating the Window Menu |
|
|
234 | (1) |
|
|
235 | (1) |
|
7.7.4 Validating Menu Items |
|
|
236 | (1) |
|
|
237 | (4) |
|
|
241 | (2) |
|
|
243 | (2) |
|
|
245 | (40) |
|
8.1 Constructing and Deconstructing Strings |
|
|
246 | (2) |
|
|
248 | (2) |
|
|
250 | (4) |
|
8.3.1 Localization Macros |
|
|
251 | (1) |
|
|
252 | (1) |
|
8.3.3 Localizing Format Strings |
|
|
253 | (1) |
|
|
254 | (1) |
|
|
255 | (6) |
|
|
257 | (4) |
|
|
261 | (1) |
|
|
261 | (14) |
|
|
261 | (3) |
|
|
264 | (4) |
|
|
268 | (1) |
|
|
269 | (1) |
|
|
270 | (5) |
|
8.7 Writing a Custom Text Container |
|
|
275 | (4) |
|
8.8 Using Multiple Text Views |
|
|
279 | (4) |
|
|
283 | (2) |
|
|
285 | (66) |
|
9 Creating Document-Driven Applications |
|
|
287 | (42) |
|
9.1 The Cocoa Document Model |
|
|
288 | (5) |
|
|
289 | (3) |
|
|
292 | (1) |
|
9.2 Creating the Application Skeleton |
|
|
293 | (2) |
|
9.3 Creating the Document |
|
|
295 | (6) |
|
9.3.1 Loading the Windows |
|
|
295 | (2) |
|
9.3.2 Building the Document Model |
|
|
297 | (1) |
|
9.3.3 Loading and Saving Documents |
|
|
297 | (4) |
|
9.3.4 Document Creation Events |
|
|
301 | (1) |
|
9.4 Extending the Outliner |
|
|
301 | (11) |
|
9.4.1 Defining a Native File Format |
|
|
302 | (2) |
|
9.4.2 Defining a Foreign File Format |
|
|
304 | (3) |
|
9.4.3 Supporting Loading and Saving |
|
|
307 | (5) |
|
|
312 | (6) |
|
9.5.1 Registering Undo Operations |
|
|
314 | (2) |
|
9.5.2 Creating Undo Groups |
|
|
316 | (1) |
|
9.5.3 Performing Undo Operations |
|
|
316 | (1) |
|
9.5.4 The Undo User Interface |
|
|
317 | (1) |
|
9.6 Adding Undo to the Outliner |
|
|
318 | (10) |
|
|
328 | (1) |
|
|
329 | (22) |
|
10.1 Introducing Data Modeling |
|
|
330 | (1) |
|
10.2 Understanding Managed Objects |
|
|
331 | (1) |
|
|
332 | (2) |
|
10.4 Creating a Data Model |
|
|
334 | (9) |
|
10.5 Choosing a Persistent Store |
|
|
343 | (2) |
|
|
343 | (1) |
|
|
343 | (1) |
|
|
344 | (1) |
|
|
344 | (1) |
|
|
345 | (1) |
|
|
345 | (2) |
|
|
347 | (1) |
|
10.8 Core Data, Spotlight, and Time Machine |
|
|
348 | (1) |
|
|
349 | (2) |
|
IV Complex User Interfaces |
|
|
351 | (80) |
|
11 Working with Structured Data |
|
|
353 | (42) |
|
11.1 Data Sources and Delegates |
|
|
354 | (1) |
|
|
354 | (8) |
|
11.2.1 Table View Drawing |
|
|
355 | (1) |
|
11.2.2 Using Sort Descriptors |
|
|
356 | (2) |
|
11.2.3 Customizing a Table View |
|
|
358 | (4) |
|
|
362 | (14) |
|
11.3.1 Extending the Outliner |
|
|
363 | (13) |
|
|
376 | (4) |
|
|
376 | (1) |
|
11.4.2 Creating a Browser |
|
|
377 | (3) |
|
|
380 | (4) |
|
11.5.1 Displaying Files in a Collection View |
|
|
381 | (3) |
|
11.6 Customizing Views with New Cells |
|
|
384 | (3) |
|
11.7 Creating Master-Detail Views |
|
|
387 | (6) |
|
11.7.1 Inspectors as Detail Views |
|
|
389 | (4) |
|
|
393 | (2) |
|
|
395 | (36) |
|
|
395 | (1) |
|
12.2 Inspecting the View Hierarchy |
|
|
396 | (2) |
|
12.3 Modifying the View Hierarchy |
|
|
398 | (14) |
|
|
399 | (4) |
|
|
403 | (4) |
|
|
407 | (5) |
|
12.4 Creating Dynamic Input Forms |
|
|
412 | (14) |
|
12.4.1 Creating a Form with a Matrix |
|
|
413 | (5) |
|
12.4.2 Creating a Form with a Custom View |
|
|
418 | (4) |
|
12.4.3 Creating a Form with a Rule Editor |
|
|
422 | (4) |
|
12.5 Full-Screen Applications |
|
|
426 | (3) |
|
|
429 | (2) |
|
|
431 | (158) |
|
|
433 | (60) |
|
13.1 The Graphics Context |
|
|
434 | (1) |
|
|
435 | (3) |
|
|
438 | (32) |
|
|
439 | (4) |
|
13.3.2 Drawing with Cells |
|
|
443 | (10) |
|
|
453 | (4) |
|
13.3.4 Creating New Cells |
|
|
457 | (6) |
|
13.3.5 Drawing Bitmap Images |
|
|
463 | (5) |
|
13.3.6 Compositing Images |
|
|
468 | (2) |
|
13.4 Printing and Paginating Views |
|
|
470 | (12) |
|
|
471 | (1) |
|
13.4.2 Creating Print Operations |
|
|
472 | (3) |
|
|
475 | (6) |
|
13.4.4 Automatic Pagination |
|
|
481 | (1) |
|
13.5 Extending Interface Builder with Palettes |
|
|
482 | (9) |
|
|
491 | (2) |
|
|
493 | (28) |
|
|
493 | (1) |
|
14.2 Playing Simple Sounds |
|
|
494 | (4) |
|
14.3 Understanding Cocoa Movie Objects |
|
|
498 | (4) |
|
|
502 | (4) |
|
|
506 | (1) |
|
14.6 Low-Level Sound APIs |
|
|
507 | (1) |
|
14.7 Sound and Video Recording |
|
|
508 | (4) |
|
|
512 | (1) |
|
14.9 Cocoa Speech Synthesis |
|
|
513 | (1) |
|
14.10 Conversing with Users |
|
|
514 | (5) |
|
|
519 | (2) |
|
15 Advanced Visual Effects |
|
|
521 | (34) |
|
|
521 | (2) |
|
15.2 Core Animation Overview |
|
|
523 | (5) |
|
15.2.1 Drawing in a Layer |
|
|
524 | (4) |
|
15.2.2 Setting a Layer's Content |
|
|
528 | (1) |
|
15.3 Understanding Animation Concepts |
|
|
528 | (3) |
|
15.4 Adding Simple Animations |
|
|
531 | (2) |
|
|
533 | (7) |
|
15.6 Defining Transitions |
|
|
540 | (3) |
|
15.7 Creating Complex Animations |
|
|
543 | (1) |
|
15.8 3D Core Animation Transforms |
|
|
544 | (5) |
|
15.9 OpenGL and Cocoa Views |
|
|
549 | (3) |
|
|
552 | (1) |
|
|
553 | (2) |
|
16 Supporting PDF and HTML |
|
|
555 | (34) |
|
|
556 | (1) |
|
16.2 Advanced HTML Support |
|
|
557 | (8) |
|
|
559 | (2) |
|
16.2.2 Web View Delegates |
|
|
561 | (1) |
|
|
562 | (3) |
|
16.3 Dynamic Interfaces with WebKit |
|
|
565 | (7) |
|
|
572 | (2) |
|
|
574 | (14) |
|
16.5.1 Understanding PDF Annotations |
|
|
578 | (3) |
|
16.5.2 Setting Document Metadata |
|
|
581 | (2) |
|
|
583 | (5) |
|
|
588 | (1) |
|
VI User Interface Integration |
|
|
589 | (162) |
|
17 Searching and Filtering |
|
|
591 | (46) |
|
17.1 Maintaining Document Indexes |
|
|
592 | (5) |
|
|
592 | (2) |
|
17.1.2 Indexing Documents |
|
|
594 | (1) |
|
17.1.3 Searching an Index |
|
|
595 | (2) |
|
17.2 Displaying Search Boxes |
|
|
597 | (2) |
|
17.3 Searching for Documents |
|
|
599 | (11) |
|
|
610 | (13) |
|
17.4.1 Monitoring Filesystem Events |
|
|
611 | (1) |
|
|
611 | (2) |
|
17.4.3 Building a Metadata Import Plugin |
|
|
613 | (6) |
|
17.4.4 Searching with Spotlight |
|
|
619 | (3) |
|
17.4.5 Spotlight Limitations |
|
|
622 | (1) |
|
|
623 | (9) |
|
17.5.1 The Predicate Language |
|
|
623 | (2) |
|
17.5.2 Creating Predicates Directly |
|
|
625 | (2) |
|
|
627 | (1) |
|
17.5.4 Displaying a Predicate Editor |
|
|
628 | (4) |
|
|
632 | (4) |
|
17.6.1 Previewing Bundles |
|
|
633 | (1) |
|
17.6.2 Implementing Quick Look Plugins |
|
|
634 | (2) |
|
|
636 | (1) |
|
18 Contacts, Calendars, and Secrets |
|
|
637 | (38) |
|
18.1 Address Book Overview |
|
|
637 | (5) |
|
|
638 | (1) |
|
18.1.2 Collection Classes |
|
|
639 | (3) |
|
18.2 Getting Information About People |
|
|
642 | (1) |
|
18.3 Searching the Address Book |
|
|
643 | (2) |
|
18.4 Populating the "Me" vCard |
|
|
645 | (3) |
|
18.5 Adding People to the Address Book |
|
|
648 | (1) |
|
|
649 | (10) |
|
|
659 | (7) |
|
18.7.1 Calendar Store Concepts |
|
|
659 | (2) |
|
|
661 | (4) |
|
18.7.3 Creating Calendars |
|
|
665 | (1) |
|
|
666 | (7) |
|
18.8.1 Using Apple Schemas |
|
|
667 | (6) |
|
|
673 | (2) |
|
|
675 | (32) |
|
|
675 | (2) |
|
|
677 | (3) |
|
|
680 | (1) |
|
|
681 | (1) |
|
19.5 Self-Encoding Objects |
|
|
682 | (1) |
|
19.6 Files and Pasteboards |
|
|
683 | (1) |
|
|
684 | (2) |
|
|
686 | (11) |
|
|
687 | (2) |
|
|
689 | (1) |
|
19.8.3 Implementing Drag and Drop in a Custom View |
|
|
690 | (7) |
|
19.9 Drag and Drop with Data Views |
|
|
697 | (8) |
|
|
705 | (2) |
|
|
707 | (14) |
|
|
707 | (2) |
|
|
709 | (5) |
|
|
714 | (3) |
|
20.4 Controlling the Services Menu |
|
|
717 | (1) |
|
|
718 | (1) |
|
|
719 | (2) |
|
|
721 | (30) |
|
|
721 | (4) |
|
21.1.1 The AppleScript Object Model |
|
|
723 | (1) |
|
21.1.2 Scripting Vocabulary |
|
|
723 | (2) |
|
21.2 Making Objects Scriptable |
|
|
725 | (15) |
|
21.2.1 Understanding AppleScript Objects |
|
|
725 | (1) |
|
21.2.2 Providing Object Specifiers |
|
|
726 | (2) |
|
21.2.3 Providing a Scripting Definition |
|
|
728 | (5) |
|
21.2.4 Handling Scripting Commands |
|
|
733 | (4) |
|
21.2.5 Testing Scripting Support |
|
|
737 | (3) |
|
21.3 Scripting from Cocoa |
|
|
740 | (7) |
|
21.4 Exposing Services to Automator |
|
|
747 | (1) |
|
21.5 Other Scripting Technologies |
|
|
748 | (2) |
|
21.5.1 Distributed Objects |
|
|
748 | (1) |
|
|
749 | (1) |
|
|
750 | (1) |
|
|
751 | (72) |
|
|
753 | (34) |
|
22.1 Low-Level Socket Programming |
|
|
753 | (6) |
|
|
759 | (1) |
|
|
760 | (8) |
|
|
761 | (1) |
|
|
762 | (2) |
|
22.3.3 Extending the URL Loading System |
|
|
764 | (4) |
|
|
768 | (5) |
|
|
768 | (1) |
|
22.4.2 DNS Service Discovery |
|
|
768 | (1) |
|
|
769 | (3) |
|
22.4.4 Advertising Services |
|
|
772 | (1) |
|
|
773 | (12) |
|
22.5.1 Publishing Objects |
|
|
774 | (2) |
|
22.5.2 Getting Remote Objects |
|
|
776 | (1) |
|
22.5.3 A Simple Chat Program |
|
|
777 | (8) |
|
|
785 | (2) |
|
|
787 | (36) |
|
|
788 | (1) |
|
|
789 | (18) |
|
|
790 | (1) |
|
23.2.2 Thread-Local Storage |
|
|
790 | (1) |
|
|
791 | (8) |
|
|
799 | (4) |
|
23.2.5 Futures and Forwarding |
|
|
803 | (3) |
|
23.2.6 Stress Testing Threads |
|
|
806 | (1) |
|
|
807 | (6) |
|
23.3.1 Creating Child Processes |
|
|
807 | (1) |
|
23.3.2 Communicating with Children |
|
|
807 | (2) |
|
|
809 | (4) |
|
|
813 | (6) |
|
23.5 Grand Central Dispatch |
|
|
819 | (2) |
|
|
821 | (1) |
|
|
822 | (1) |
|
|
823 | (62) |
|
|
825 | (12) |
|
|
825 | (1) |
|
24.2 Mobile OS X on the iPhone |
|
|
826 | (1) |
|
|
826 | (1) |
|
|
827 | (6) |
|
|
829 | (1) |
|
24.4.2 Building with GNUstep |
|
|
830 | (2) |
|
|
832 | (1) |
|
|
833 | (1) |
|
|
834 | (1) |
|
|
834 | (3) |
|
|
837 | (48) |
|
|
838 | (5) |
|
|
838 | (1) |
|
|
838 | (2) |
|
25.1.3 Objective-C Constants |
|
|
840 | (1) |
|
|
841 | (1) |
|
25.1.5 Friendly Debug Output |
|
|
842 | (1) |
|
|
843 | (8) |
|
25.2.1 NSDictionary Abuse |
|
|
843 | (1) |
|
|
844 | (2) |
|
|
846 | (3) |
|
|
849 | (2) |
|
|
851 | (4) |
|
25.3.1 Toll-Free Bridging |
|
|
851 | (2) |
|
25.3.2 Multiple Inheritance |
|
|
853 | (2) |
|
|
855 | (14) |
|
25.4.1 Instance Method Pointers |
|
|
855 | (2) |
|
25.4.2 Subverting Dynamic Dispatch |
|
|
857 | (2) |
|
25.4.3 Objects on the Stack |
|
|
859 | (5) |
|
|
864 | (1) |
|
|
865 | (2) |
|
|
867 | (2) |
|
25.5 Cross-Platform Cocoa |
|
|
869 | (3) |
|
|
872 | (13) |
|
25.6.1 Understanding Object Implementation |
|
|
873 | (3) |
|
25.6.2 Enumerating All Subclasses |
|
|
876 | (3) |
|
25.6.3 Adding Methods to a Class |
|
|
879 | (6) |
Index |
|
885 | |