Preface |
|
xvii | |
Acknowledgments |
|
xix | |
|
|
1 | (8) |
|
|
1 | (2) |
|
|
3 | (1) |
|
Objects, Classes, Methods, and Messages |
|
|
4 | (1) |
|
|
5 | (1) |
|
|
6 | (1) |
|
Typographical Conventions |
|
|
7 | (1) |
|
|
7 | (2) |
|
|
9 | (24) |
|
|
9 | (4) |
|
|
9 | (3) |
|
|
12 | (1) |
|
|
13 | (11) |
|
|
15 | (1) |
|
|
15 | (1) |
|
|
16 | (1) |
|
|
17 | (1) |
|
|
18 | (3) |
|
|
21 | (1) |
|
|
21 | (3) |
|
|
24 | (6) |
|
Types and Constants in Objective-C |
|
|
26 | (1) |
|
|
26 | (1) |
|
Edit the Implementation File |
|
|
27 | (1) |
|
|
28 | (1) |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
30 | (3) |
|
|
33 | (40) |
|
Creating and Using Instances |
|
|
33 | (2) |
|
|
35 | (14) |
|
Memory Management: Retain Count, Releasing, and Retaining |
|
|
40 | (2) |
|
|
42 | (1) |
|
|
43 | (1) |
|
NSObject, NSArray, NSMutableArray, and NSString |
|
|
43 | (1) |
|
|
43 | (2) |
|
|
45 | (2) |
|
|
47 | (1) |
|
|
47 | (1) |
|
``Inherits From'' Versus ``Uses'' or ``Knows About'' |
|
|
48 | (1) |
|
Creating Your Own Classes |
|
|
49 | (18) |
|
Creating the LotteryEntry Class |
|
|
49 | (1) |
|
|
49 | (3) |
|
|
52 | (1) |
|
|
53 | (1) |
|
|
54 | (1) |
|
Implementing a description Method |
|
|
55 | (1) |
|
Creating Autoreleased Objects |
|
|
56 | (5) |
|
|
61 | (3) |
|
|
64 | (2) |
|
Initializers with Arguments |
|
|
66 | (1) |
|
|
67 | (3) |
|
|
70 | (1) |
|
For the More Curious: How Does Messaging Work? |
|
|
71 | (1) |
|
|
72 | (1) |
|
|
73 | (30) |
|
Some Commonly Used Subclasses of NSControl |
|
|
75 | (4) |
|
|
75 | (2) |
|
|
77 | (1) |
|
|
78 | (1) |
|
Start the RaiseMan Example |
|
|
79 | (2) |
|
The Interface File for MyDocument |
|
|
81 | (2) |
|
|
83 | (11) |
|
|
86 | (1) |
|
|
87 | (1) |
|
|
88 | (4) |
|
NSWindow's initialFirstResponder Outlet |
|
|
92 | (1) |
|
NSView's nextKey View Outlet |
|
|
92 | (2) |
|
|
94 | (1) |
|
Implementing the Person Class |
|
|
94 | (2) |
|
Implementing the MyDocument Class |
|
|
96 | (4) |
|
|
100 | (1) |
|
For the More Curious: Setting the Target Programmatically |
|
|
101 | (1) |
|
|
101 | (2) |
|
|
103 | (18) |
|
NSTableView and Its Data Source |
|
|
104 | (1) |
|
MyDocument Interface File |
|
|
105 | (1) |
|
Lay Out the User Interface |
|
|
106 | (3) |
|
|
109 | (2) |
|
|
111 | (2) |
|
|
113 | (2) |
|
|
115 | (3) |
|
Common Errors in Implementing a Delegate |
|
|
117 | (1) |
|
Which Objects Have Delegates? |
|
|
117 | (1) |
|
|
118 | (1) |
|
For the More Curious: How Delegates Work |
|
|
118 | (1) |
|
|
119 | (1) |
|
|
119 | (2) |
|
|
121 | (18) |
|
|
122 | (3) |
|
|
123 | (1) |
|
|
124 | (1) |
|
The Document Architecture |
|
|
125 | (3) |
|
Info.plist and NSDocumentController |
|
|
125 | (1) |
|
|
126 | (1) |
|
|
126 | (1) |
|
|
127 | (1) |
|
|
128 | (1) |
|
|
128 | (1) |
|
|
129 | (1) |
|
Informing the Document That It Has Been Edited |
|
|
130 | (1) |
|
Setting the Extension and Icon for the File Type |
|
|
131 | (3) |
|
For the More Curious: Preventing Infinite Loops |
|
|
134 | (1) |
|
For the More Curious: Versioning |
|
|
135 | (1) |
|
For the More Curious: Creating a Protocol |
|
|
136 | (3) |
|
Nib Files and NSWindowController |
|
|
139 | (16) |
|
|
139 | (1) |
|
Adding a Panel to the Application |
|
|
140 | (12) |
|
|
140 | (2) |
|
|
142 | (3) |
|
|
145 | (1) |
|
|
145 | (2) |
|
|
147 | (1) |
|
Lay Out the User Interface |
|
|
148 | (3) |
|
|
151 | (1) |
|
For the More Curious: NSBundle |
|
|
152 | (2) |
|
|
154 | (1) |
|
|
154 | (1) |
|
|
155 | (1) |
|
NSDictionary and NSMutableDictionary |
|
|
155 | (3) |
|
|
157 | (1) |
|
|
158 | (1) |
|
|
158 | (2) |
|
Precedence of Different Types of Defaults |
|
|
160 | (1) |
|
Creating Keys for the Names of the Defaults |
|
|
160 | (1) |
|
|
161 | (1) |
|
Let the User Edit the Defaults |
|
|
161 | (2) |
|
|
163 | (2) |
|
Suppressing the Creation of Unititled Documents |
|
|
163 | (1) |
|
Setting the Background Color on the Table View |
|
|
164 | (1) |
|
Saving the Frame of a Window |
|
|
165 | (1) |
|
For the More Curious: Reading and Writing Defaults from the Command Line |
|
|
165 | (1) |
|
|
166 | (1) |
|
|
167 | (8) |
|
|
167 | (1) |
|
What Notifications Are Not |
|
|
168 | (1) |
|
|
168 | (1) |
|
|
168 | (3) |
|
|
171 | (1) |
|
Registering As an Observer |
|
|
171 | (1) |
|
Unregistering the Observer |
|
|
172 | (1) |
|
Handling the Notification When It Arrives |
|
|
172 | (1) |
|
For the More Curious: Delegates and Notifications |
|
|
173 | (1) |
|
For the More Curious: The userInfo Dictionary |
|
|
173 | (1) |
|
|
174 | (1) |
|
|
175 | (4) |
|
Make the User Confirm the Delete |
|
|
176 | (2) |
|
|
178 | (1) |
|
|
179 | (10) |
|
|
180 | (2) |
|
|
182 | (3) |
|
|
182 | (3) |
|
|
185 | (1) |
|
For the More Curious: nibtool |
|
|
185 | (2) |
|
|
187 | (2) |
|
|
189 | (16) |
|
|
189 | (2) |
|
Get a View to Draw Itself |
|
|
191 | (6) |
|
Create an Instance of a View Subclass |
|
|
193 | (1) |
|
|
194 | (1) |
|
|
194 | (3) |
|
Drawing with NSBezierPath |
|
|
197 | (2) |
|
|
199 | (2) |
|
For the More Curious: Cells |
|
|
201 | (3) |
|
|
204 | (1) |
|
|
205 | (18) |
|
|
205 | (1) |
|
|
205 | (2) |
|
|
207 | (1) |
|
|
207 | (8) |
|
|
209 | (3) |
|
|
212 | (1) |
|
|
213 | (2) |
|
Composite an Image Onto Your View |
|
|
215 | (2) |
|
The View's Coordinate System |
|
|
217 | (3) |
|
|
220 | (1) |
|
For the More Curious: NSImage |
|
|
220 | (1) |
|
|
221 | (2) |
|
Responders and Keyboard Events |
|
|
223 | (14) |
|
|
224 | (2) |
|
|
226 | (1) |
|
Create a New Project with a Custom View |
|
|
226 | (11) |
|
|
226 | (3) |
|
|
229 | (1) |
|
|
230 | (1) |
|
|
230 | (2) |
|
|
232 | (1) |
|
|
232 | (2) |
|
|
234 | (3) |
|
Working with Fonts and NSString |
|
|
237 | (10) |
|
|
237 | (1) |
|
Commonly Used Methods in NSFont |
|
|
237 | (1) |
|
|
238 | (2) |
|
Drawing Strings and Attributed Strings |
|
|
240 | (1) |
|
|
241 | (2) |
|
Getting Your View to Generate PDF Data |
|
|
243 | (2) |
|
For the More Curious: NSFontManager |
|
|
245 | (1) |
|
|
246 | (1) |
|
|
246 | (1) |
|
Pasteboards and Nil-Targeted Actions |
|
|
247 | (10) |
|
|
248 | (1) |
|
Add Cut, Copy, and Paste to BigLetterView |
|
|
249 | (2) |
|
|
251 | (3) |
|
|
252 | (2) |
|
For the More Curious: Which Object Really Sends the Action Message? |
|
|
254 | (1) |
|
For the More Curious: Lazy Copying |
|
|
254 | (1) |
|
|
255 | (2) |
|
|
257 | (4) |
|
|
257 | (4) |
|
|
261 | (8) |
|
Make BigLetterView a Drag Source |
|
|
261 | (3) |
|
Make BigLetterView a Drag Destination |
|
|
264 | (4) |
|
|
264 | (1) |
|
|
265 | (1) |
|
Implement the Dragging Destination Methods |
|
|
266 | (1) |
|
|
267 | (1) |
|
|
268 | (1) |
|
|
269 | (10) |
|
|
269 | (2) |
|
|
271 | (2) |
|
Adding Code to AppController |
|
|
273 | (3) |
|
|
276 | (3) |
|
|
279 | (12) |
|
|
280 | (6) |
|
|
280 | (1) |
|
|
281 | (2) |
|
|
283 | (3) |
|
For the More Curious: contextInfo |
|
|
286 | (1) |
|
For the More Curious: NSDrawer |
|
|
287 | (1) |
|
|
288 | (3) |
|
|
291 | (14) |
|
|
292 | (7) |
|
Edit the Interface File for the AppController Class |
|
|
293 | (1) |
|
|
294 | (1) |
|
|
294 | (1) |
|
Searching Strings for Substrings |
|
|
295 | (1) |
|
Create a Subclass of NSFormatter |
|
|
296 | (3) |
|
The Delegate of the NSControl |
|
|
299 | (1) |
|
|
300 | (1) |
|
The Control's Delegate and Partial Strings |
|
|
301 | (1) |
|
Formatters That Return Attributed Strings |
|
|
302 | (1) |
|
|
302 | (3) |
|
|
305 | (10) |
|
Adding Printing to Typing Tutor |
|
|
305 | (2) |
|
|
307 | (6) |
|
|
313 | (2) |
|
|
315 | (6) |
|
Making a BigLetterView Uncopyable |
|
|
316 | (5) |
|
|
321 | (20) |
|
|
322 | (1) |
|
Messages the Delegate Will Be Sent |
|
|
323 | (1) |
|
Build the Editor with Which This Book Was Written |
|
|
324 | (13) |
|
Read, Write, and Edit Text Files |
|
|
324 | (5) |
|
Adding a Context-Sensitive Menu |
|
|
329 | (3) |
|
|
332 | (3) |
|
|
335 | (1) |
|
|
336 | (1) |
|
|
337 | (1) |
|
For the More Curious: The Field Editor |
|
|
337 | (4) |
|
|
341 | (8) |
|
Don't Use Java to Write Cocoa Applications |
|
|
341 | (1) |
|
If You Must Use Java to Write Cocoa Applications |
|
|
342 | (7) |
|
Create a New Project and Lay Out the Interface |
|
|
342 | (2) |
|
|
344 | (2) |
|
|
346 | (1) |
|
Subclassing Cocoa Classes in Java |
|
|
347 | (1) |
|
|
348 | (1) |
|
Creating Interface Builder Palettes |
|
|
349 | (20) |
|
Add NSCoding Methods to BigLetterView |
|
|
350 | (2) |
|
|
352 | (2) |
|
Edit the Nib File for Your Palette |
|
|
354 | (1) |
|
|
354 | (2) |
|
|
356 | (1) |
|
|
357 | (1) |
|
|
358 | (7) |
|
Create a Nib File for Your Inspector |
|
|
359 | (2) |
|
|
361 | (4) |
|
For the More Curious: How to Palettize Objects That Are Not Views |
|
|
365 | (2) |
|
|
367 | (2) |
|
|
369 | (2) |
Index |
|
371 | |