Preface |
|
xi | |
1. Setup and First Run |
|
1 | |
|
Download and Install Xcode |
|
|
1 | |
|
|
4 | |
|
|
7 | |
|
Run the Finished Application |
|
|
11 | |
2. Thinking in Code: Basic C |
|
15 | |
|
|
15 | |
|
|
17 | |
|
|
20 | |
|
|
21 | |
|
|
23 | |
|
|
24 | |
|
|
24 | |
|
|
24 | |
|
|
28 | |
|
|
28 | |
|
Displaying Values on the Command Line |
|
|
29 | |
|
Compile and Run the Example |
|
|
32 | |
|
|
34 | |
|
|
35 | |
|
|
36 | |
|
|
39 | |
|
|
41 | |
|
|
42 | |
3. Memory and Pointers: Advanced C |
|
43 | |
|
|
43 | |
|
|
45 | |
|
|
47 | |
|
|
48 | |
|
|
49 | |
|
|
50 | |
|
|
50 | |
|
Pointers and the const Keyword |
|
|
52 | |
|
|
53 | |
|
Strings and Dynamic Memory |
|
|
56 | |
|
Returning Strings from Functions |
|
|
57 | |
|
|
58 | |
|
|
59 | |
|
Compile and Run the AddressBook Example |
|
|
61 | |
|
|
62 | |
|
|
64 | |
|
Compile and Run the HeaderFileTest Example |
|
|
66 | |
|
Create Files for the Song Struct |
|
|
66 | |
|
|
68 | |
4. Thinking in Objects |
|
73 | |
|
|
74 | |
|
|
76 | |
|
|
77 | |
|
|
78 | |
|
|
80 | |
|
|
81 | |
|
|
81 | |
5. Basic Objective-C |
|
83 | |
|
|
84 | |
|
|
84 | |
|
|
86 | |
|
|
86 | |
|
|
86 | |
|
|
87 | |
|
|
88 | |
|
|
88 | |
|
Using Autorelease Directly |
|
|
90 | |
|
|
90 | |
|
|
91 | |
|
|
92 | |
|
|
94 | |
|
|
95 | |
|
|
96 | |
6. More Objective-C |
|
103 | |
|
More on Memory Management |
|
|
103 | |
|
The Life of an Instance Variable |
|
|
105 | |
|
|
106 | |
|
|
107 | |
|
|
107 | |
|
|
109 | |
|
|
111 | |
|
|
112 | |
|
|
113 | |
|
All Further Examples Assume 64-Bit |
|
|
114 | |
|
|
114 | |
|
Categories for Private Methods |
|
|
116 | |
|
|
118 | |
|
|
120 | |
|
|
124 | |
|
Using Selectors to Call Methods |
|
|
125 | |
|
|
126 | |
|
|
127 | |
|
|
129 | |
|
Some New Classes and Methods |
|
|
129 | |
|
|
130 | |
|
|
136 | |
7. Foundation Value Gasses |
|
137 | |
|
|
138 | |
|
|
140 | |
|
Using NSString with C Types |
|
|
141 | |
|
Comparing Strings for Equality |
|
|
141 | |
|
|
142 | |
|
Reading and Writing Files with Strings |
|
|
144 | |
|
|
148 | |
|
|
149 | |
|
Advantages of Immutability |
|
|
150 | |
|
|
150 | |
|
|
152 | |
|
Core Foundation Mutability |
|
|
153 | |
|
|
154 | |
|
Core Foundation Types As Properties |
|
|
155 | |
|
Drawbacks of Core Foundation Types |
|
|
156 | |
|
|
156 | |
|
|
156 | |
|
|
159 | |
|
|
160 | |
|
|
161 | |
|
|
163 | |
|
When to Use Which Number Type |
|
|
165 | |
|
|
166 | |
|
|
168 | |
|
|
169 | |
|
|
171 | |
|
|
171 | |
|
|
173 | |
|
|
174 | |
|
|
175 | |
|
|
177 | |
|
|
178 | |
|
|
179 | |
|
|
181 | |
|
|
182 | |
|
|
183 | |
|
|
184 | |
|
|
186 | |
8. Bask Controls |
|
189 | |
|
|
189 | |
|
|
190 | |
|
|
193 | |
|
|
194 | |
|
|
195 | |
|
|
198 | |
|
|
203 | |
|
|
206 | |
|
|
211 | |
|
|
214 | |
|
|
216 | |
|
|
218 | |
|
|
222 | |
|
Table View Datasource Methods |
|
|
226 | |
|
Implementing Datasource Methods |
|
|
227 | |
|
|
230 | |
|
|
234 | |
|
Bindings for Simple Controls |
|
|
236 | |
|
Bindings for Complex Controls |
|
|
242 | |
|
Tips for Debugging Bindings |
|
|
244 | |
|
9. Designing Applications Using MVC |
|
|
247 | |
|
|
248 | |
|
|
249 | |
|
|
250 | |
|
|
253 | |
|
|
254 | |
|
|
254 | |
|
Add Attributes and Relationships |
|
|
255 | |
|
|
261 | |
|
|
264 | |
|
Create the Window Controller |
|
|
264 | |
|
Create the View Controllers |
|
|
268 | |
|
Create the Managed Object Classes |
|
|
280 | |
|
Create the User Interface |
|
|
286 | |
|
Remove the Default Window |
|
|
287 | |
|
Create the Main Window Interface |
|
|
289 | |
|
Create the Browser Interface |
|
|
293 | |
|
Create the Editor View Interface |
|
|
297 | |
|
Create the List View Interface |
|
|
298 | |
|
|
301 | |
|
|
303 | |
10. Custom Views and Drawing |
|
307 | |
|
|
308 | |
|
Geometry Structs As Strings |
|
|
310 | |
|
Geometry Structs As NSValues |
|
|
311 | |
|
|
312 | |
|
|
313 | |
|
|
314 | |
|
|
315 | |
|
|
316 | |
|
|
316 | |
|
|
320 | |
|
|
323 | |
|
|
324 | |
|
|
324 | |
|
|
325 | |
|
|
329 | |
|
|
329 | |
|
|
331 | |
|
|
338 | |
|
Add a Shadow to StyledImageView |
|
|
338 | |
|
|
341 | |
|
Drawing a Gradient Background |
|
|
342 | |
|
|
344 | |
|
|
349 | |
|
|
350 | |
|
|
350 | |
|
|
352 | |
|
Refactored Implementation |
|
|
354 | |
|
Test the Refactored Version |
|
|
359 | |
|
|
359 | |
|
|
359 | |
|
|
360 | |
|
Add a Title to StyledImageView |
|
|
365 | |
|
Handling Mouse and Keyboard Events |
|
|
370 | |
|
|
371 | |
|
|
372 | |
|
Add Event Support to StyledImageView |
|
|
372 | |
11. The Final Word |
|
377 | |
|
|
377 | |
|
|
378 | |
|
|
380 | |
Index |
|
381 | |