I Getting Started |
|
1 | (18) |
|
|
3 | (4) |
|
|
3 | (1) |
|
|
4 | (1) |
|
How the life of a programmer works |
|
|
4 | (3) |
|
|
7 | (12) |
|
Installing Apple's developer tools |
|
|
7 | (1) |
|
Getting started with Xcode |
|
|
7 | (2) |
|
Where do I start writing code? |
|
|
9 | (5) |
|
|
14 | (1) |
|
|
15 | (1) |
|
|
16 | (3) |
II How Programming Works |
|
19 | (64) |
|
|
21 | (4) |
|
|
21 | (1) |
|
|
22 | (2) |
|
|
24 | (1) |
|
|
25 | (4) |
|
|
27 | (1) |
|
When curly braces are optional |
|
|
27 | (1) |
|
|
27 | (1) |
|
For the more curious: conditional operators |
|
|
28 | (1) |
|
|
28 | (1) |
|
|
29 | (14) |
|
When should I use a function? |
|
|
29 | (1) |
|
How do I write and use a function? |
|
|
29 | (2) |
|
How functions work together |
|
|
31 | (2) |
|
|
32 | (1) |
|
Local variables, frames, and the stack |
|
|
33 | (1) |
|
|
34 | (1) |
|
|
35 | (3) |
|
Looking at frames in the debugger |
|
|
38 | (2) |
|
|
40 | (1) |
|
Global and static variables |
|
|
41 | (1) |
|
|
42 | (1) |
|
|
43 | (4) |
|
|
43 | (1) |
|
|
44 | (1) |
|
|
45 | (2) |
|
|
47 | (8) |
|
|
47 | (5) |
|
Tokens for displaying integers |
|
|
48 | (1) |
|
|
49 | (3) |
|
|
52 | (1) |
|
Tokens for displaying floating-point numbers |
|
|
52 | (1) |
|
|
52 | (1) |
|
|
53 | (1) |
|
|
53 | (2) |
|
|
55 | (10) |
|
|
56 | (1) |
|
|
57 | (1) |
|
|
58 | (1) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
60 | (1) |
|
|
61 | (4) |
|
|
65 | (6) |
|
|
65 | (1) |
|
Storing addresses in pointers |
|
|
66 | (1) |
|
Getting the data at an address |
|
|
67 | (1) |
|
|
67 | (1) |
|
|
68 | (1) |
|
Stylish pointer declarations |
|
|
69 | (1) |
|
Challenge: how much memory? |
|
|
70 | (1) |
|
Challenge: how much range? |
|
|
70 | (1) |
|
|
71 | (4) |
|
Writing pass-by-reference functions |
|
|
72 | (2) |
|
|
74 | (1) |
|
|
74 | (1) |
|
|
75 | (4) |
|
|
77 | (2) |
|
|
79 | (4) |
III Objective-C and Foundation |
|
83 | (154) |
|
|
85 | (10) |
|
|
85 | (3) |
|
|
85 | (1) |
|
Creating your first object |
|
|
86 | (2) |
|
|
88 | (6) |
|
|
88 | (1) |
|
|
89 | (1) |
|
Class methods vs. instance methods |
|
|
90 | (1) |
|
|
91 | (2) |
|
|
93 | (1) |
|
|
94 | (1) |
|
|
95 | (8) |
|
A message with an argument |
|
|
95 | (1) |
|
|
96 | (2) |
|
|
98 | (1) |
|
|
99 | (1) |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
100 | (3) |
|
|
103 | (6) |
|
On pointers and their values |
|
|
103 | (2) |
|
|
105 | (4) |
|
|
106 | (3) |
|
|
109 | (10) |
|
Creating instances of NSString |
|
|
109 | (1) |
|
|
109 | (1) |
|
|
110 | (6) |
|
Other parts of the documentation y |
|
|
116 | (1) |
|
Challenge: finding more NSString methods |
|
|
117 | (1) |
|
Challenge: using readline() |
|
|
117 | (2) |
|
|
119 | (10) |
|
|
119 | (1) |
|
|
120 | (3) |
|
|
123 | (2) |
|
|
125 | (1) |
|
|
126 | (1) |
|
Challenge: a grocery list |
|
|
127 | (1) |
|
Challenge: interesting names |
|
|
127 | (2) |
|
|
129 | (8) |
|
|
133 | (1) |
|
Accessor naming conventions |
|
|
133 | (1) |
|
|
134 | (1) |
|
|
134 | (1) |
|
|
134 | (1) |
|
|
135 | (2) |
|
|
137 | (4) |
|
|
137 | (1) |
|
|
138 | (1) |
|
|
139 | (2) |
|
|
141 | (10) |
|
|
144 | (1) |
|
|
145 | (1) |
|
|
146 | (1) |
|
|
147 | (1) |
|
|
148 | (3) |
|
21 Object Instance Variables and Properties |
|
|
151 | (10) |
|
|
153 | (6) |
|
Creating the BNRAsset class |
|
|
154 | (1) |
|
Adding a to-many relationship to BNREmployee |
|
|
155 | (4) |
|
Challenge: holding portfolio |
|
|
159 | (1) |
|
Challenge: removing assets |
|
|
160 | (1) |
|
|
161 | (4) |
|
|
162 | (1) |
|
|
163 | (1) |
|
Headers and generated instance variables |
|
|
164 | (1) |
|
|
164 | (1) |
|
23 Preventing Memory Leaks |
|
|
165 | (12) |
|
|
167 | (3) |
|
|
170 | (1) |
|
Zeroing of weak references |
|
|
171 | (2) |
|
For the More Curious: manual reference counting and ARC history |
|
|
173 | (4) |
|
|
174 | (3) |
|
|
177 | (12) |
|
|
177 | (3) |
|
NSDictionary/NSMutableDictionary |
|
|
180 | (3) |
|
|
183 | (1) |
|
|
184 | (1) |
|
|
185 | (1) |
|
Collections and ownership |
|
|
186 | (1) |
|
|
186 | (1) |
|
|
187 | (1) |
|
|
187 | (1) |
|
|
187 | (1) |
|
Challenge: sorted holdings |
|
|
187 | (2) |
|
|
189 | (8) |
|
|
190 | (2) |
|
|
191 | (1) |
|
|
191 | (1) |
|
|
192 | (1) |
|
|
193 | (2) |
|
#define vs. global variables |
|
|
195 | (2) |
|
26 Writing Files with NSString and NSData |
|
|
197 | (8) |
|
Writing an NSString to a file |
|
|
197 | (1) |
|
|
198 | (2) |
|
Reading files with NSString |
|
|
200 | (1) |
|
Writing an NSData object to a file |
|
|
200 | (2) |
|
Reading an NSData from a file |
|
|
202 | (1) |
|
Finding special directories |
|
|
202 | (3) |
|
|
205 | (12) |
|
|
206 | (1) |
|
|
206 | (3) |
|
|
209 | (3) |
|
|
212 | (2) |
|
|
214 | (1) |
|
Callbacks and object ownership |
|
|
214 | (1) |
|
For the more curious: how selectors work |
|
|
215 | (2) |
|
|
217 | (12) |
|
|
218 | (5) |
|
Declaring a block variable |
|
|
218 | (1) |
|
|
219 | (1) |
|
|
220 | (2) |
|
|
222 | (1) |
|
Blocks vs. other callbacks |
|
|
223 | (1) |
|
|
223 | (4) |
|
|
223 | (1) |
|
|
224 | (1) |
|
|
224 | (3) |
|
Challenge: an anonymous block |
|
|
227 | (1) |
|
Challenge: using a block with NSNotificationCenter |
|
|
227 | (2) |
|
|
229 | (4) |
|
|
231 | (2) |
|
|
233 | (4) |
|
|
236 | (1) |
IV Event-Driven Applications |
|
237 | (42) |
|
31 Your First iOS Application |
|
|
239 | (20) |
|
|
239 | (1) |
|
Getting started with iTahDoodle |
|
|
240 | (1) |
|
|
241 | (1) |
|
|
242 | (2) |
|
|
244 | (1) |
|
|
245 | (3) |
|
Running on the iOS simulator |
|
|
248 | (1) |
|
|
249 | (2) |
|
|
251 | (4) |
|
|
255 | (2) |
|
Adding a C helper function |
|
|
255 | (1) |
|
|
256 | (1) |
|
|
256 | (1) |
|
For the more curious: what about main()? |
|
|
257 | (1) |
|
For the more curious: running iTahDoodle on a device |
|
|
257 | (2) |
|
32 Your First Cocoa Application |
|
|
259 | (20) |
|
Getting started with TahDoodle |
|
|
260 | (2) |
|
Setting up views in Interface Builder |
|
|
262 | (8) |
|
|
263 | (2) |
|
Setting up the table view |
|
|
265 | (3) |
|
Adding autolayout constraints |
|
|
268 | (2) |
|
|
270 | (5) |
|
|
270 | (1) |
|
Setting the button's target-action pair |
|
|
271 | (2) |
|
Connecting the table view |
|
|
273 | (2) |
|
Implementing NSTableViewDataSource |
|
|
275 | (2) |
|
|
277 | (1) |
|
|
278 | (1) |
V Advanced Objective-C |
|
279 | (28) |
|
|
281 | (10) |
|
|
281 | (1) |
|
|
282 | (1) |
|
|
282 | (1) |
|
Using and checking the superclass initializer |
|
|
283 | (1) |
|
init methods that take arguments |
|
|
283 | (2) |
|
|
285 | (1) |
|
|
286 | (3) |
|
|
289 | (2) |
|
|
291 | (6) |
|
More on property attributes |
|
|
291 | (3) |
|
|
291 | (1) |
|
|
291 | (3) |
|
Advice on atomic vs. nonatomic |
|
|
294 | (1) |
|
Implementing accessor methods |
|
|
294 | (3) |
|
|
297 | (4) |
|
|
299 | (1) |
|
|
299 | (2) |
|
|
301 | (4) |
|
|
302 | (1) |
|
Triggering the notification explicitly |
|
|
303 | (1) |
|
|
304 | (1) |
|
|
305 | (2) |
|
|
306 | (1) |
VI Advanced C |
|
307 | (30) |
|
|
309 | (8) |
|
|
310 | (1) |
|
|
311 | (1) |
|
|
312 | (2) |
|
|
312 | (1) |
|
|
313 | (1) |
|
|
313 | (1) |
|
|
314 | (1) |
|
Using enum to define bit masks |
|
|
314 | (1) |
|
|
315 | (1) |
|
|
315 | (2) |
|
|
317 | (6) |
|
|
317 | (1) |
|
|
318 | (3) |
|
|
321 | (1) |
|
Converting to and from NSString |
|
|
322 | (1) |
|
|
322 | (1) |
|
|
323 | (6) |
|
|
325 | (4) |
|
41 Running from the Command Line |
|
|
329 | (6) |
|
|
330 | (3) |
|
More convenient running from the command-line |
|
|
333 | (2) |
|
|
335 | (2) |
Appendix: The Objective-C Runtime |
|
337 | (8) |
|
|
337 | (1) |
|
Dynamic method lookup and execution |
|
|
337 | (1) |
|
Management of classes and inheritance hierarchies |
|
|
338 | (4) |
|
|
342 | (2) |
|
|
344 | (1) |
|
Challenge: instance variables |
|
|
344 | (1) |
Next Steps |
|
345 | (2) |
Index |
|
347 | |