About the Author |
|
xvii | |
About the Technical Reviewer |
|
xix | |
Acknowledgments |
|
xxi | |
|
Chapter 1 Getting to Know the iOS Landscape |
|
|
1 | (12) |
|
|
2 | (1) |
|
|
2 | (8) |
|
Your Options as a Developer |
|
|
4 | (2) |
|
|
6 | (1) |
|
Some Unique Aspects About Working in iOS |
|
|
6 | (4) |
|
|
10 | (2) |
|
What's New in This Update? |
|
|
11 | (1) |
|
|
11 | (1) |
|
|
12 | (1) |
|
Chapter 2 Writing Your First App |
|
|
13 | (38) |
|
Creating the Hello World Project |
|
|
14 | (17) |
|
Taking a Look at the Xcode Project Window |
|
|
18 | (12) |
|
Taking a Closer Look at the Hello World Project |
|
|
30 | (1) |
|
Introducing Xcode's Interface Builder |
|
|
31 | (9) |
|
|
32 | (1) |
|
|
32 | (2) |
|
Exploring the Utilities Area |
|
|
34 | (2) |
|
Adding a Label to the View |
|
|
36 | (2) |
|
|
38 | (2) |
|
Adding the Finishing Touches |
|
|
40 | (4) |
|
Exploring the Launch Screen |
|
|
44 | (2) |
|
Running the Application on a Device |
|
|
46 | (4) |
|
|
50 | (1) |
|
Chapter 3 Basic User Interactions |
|
|
51 | (36) |
|
Understanding the MVC Paradigm |
|
|
52 | (1) |
|
Creating the ButtonFun App |
|
|
52 | (1) |
|
Understanding the ViewController |
|
|
53 | (30) |
|
Understanding Outlets and Actions |
|
|
55 | (2) |
|
Simplifying the View Controller |
|
|
57 | (1) |
|
Designing the User Interface |
|
|
57 | (11) |
|
Testing the ButtonFun App |
|
|
68 | (12) |
|
|
80 | (2) |
|
|
82 | (1) |
|
Examining the Application Delegate |
|
|
83 | (3) |
|
|
86 | (1) |
|
Chapter 4 Adding Intermediate-Level User Interactions |
|
|
87 | (44) |
|
Understanding Active, Static, and Passive Controls |
|
|
92 | (1) |
|
Creating the ControlFun Application |
|
|
93 | (1) |
|
Implementing the Image View and Text Fields |
|
|
93 | (37) |
|
|
94 | (2) |
|
|
96 | (2) |
|
|
98 | (1) |
|
|
98 | (1) |
|
Using the Semantic Attribute |
|
|
98 | (1) |
|
|
99 | (1) |
|
Using Interaction Check Boxes |
|
|
99 | (1) |
|
|
99 | (1) |
|
|
99 | (1) |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
100 | (1) |
|
|
100 | (6) |
|
Using Text Field Inspector Settings |
|
|
106 | (1) |
|
Setting the Attributes for the Second Text Field |
|
|
107 | (1) |
|
|
107 | (1) |
|
Creating and Connecting Outlets |
|
|
108 | (2) |
|
|
110 | (1) |
|
Closing the Keyboard When Done Is Tapped |
|
|
111 | (1) |
|
Touching the Background to Close the Keyboard |
|
|
112 | (2) |
|
Adding the Slider and Label |
|
|
114 | (2) |
|
Creating and Connecting the Actions and Outlets |
|
|
116 | (1) |
|
Implementing the Action Method |
|
|
117 | (1) |
|
Implementing the Switches, Button, and Segmented Control |
|
|
117 | (2) |
|
Adding Two Labeled Switches |
|
|
119 | (1) |
|
Connecting and Creating Outlets and Actions |
|
|
120 | (1) |
|
Implementing the Switch Actions |
|
|
120 | (1) |
|
|
120 | (2) |
|
Adding an Image to the Button |
|
|
122 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
Connecting and Creating the Button Outlets and Actions |
|
|
124 | (1) |
|
Implementing the Segmented Control Action |
|
|
124 | (1) |
|
Implementing the Action Sheet and Alert |
|
|
125 | (1) |
|
Displaying an Action Sheet |
|
|
126 | (3) |
|
|
129 | (1) |
|
|
130 | (1) |
|
Chapter 5 Working with Device Rotations |
|
|
131 | (48) |
|
Understanding the Mechanics of Rotation |
|
|
132 | (1) |
|
Understanding Points, Pixels, and the Retina Display |
|
|
132 | (1) |
|
|
133 | (1) |
|
Creating Your Orientations Project |
|
|
133 | (4) |
|
Understanding Supported Orientations at the App Level |
|
|
133 | (3) |
|
Understanding Per-Controller Rotation Support |
|
|
136 | (1) |
|
Creating Your Layout Project |
|
|
137 | (10) |
|
Overriding Default Constraints |
|
|
143 | (1) |
|
|
144 | (3) |
|
Creating Adaptive Layouts |
|
|
147 | (31) |
|
Creating the Restructure Application |
|
|
147 | (9) |
|
Setting the iPhone Landscape (wC hC) Configuration |
|
|
156 | (13) |
|
Setting the iPad (iPhone Plus Landscape) (wR hR) Configurations |
|
|
169 | (9) |
|
|
178 | (1) |
|
Chapter 6 Creating a Multiview Application |
|
|
179 | (30) |
|
Looking at Common Types of Multiview Apps |
|
|
179 | (6) |
|
Looking at the Architecture of a Multiview Application |
|
|
185 | (3) |
|
Understanding the Root Controller |
|
|
188 | (1) |
|
|
188 | (1) |
|
Creating the View Switcher Application |
|
|
188 | (19) |
|
Renaming the View Controller |
|
|
189 | (2) |
|
Adding the Content View Controllers |
|
|
191 | (1) |
|
Modifying SwitchingViewController.swift |
|
|
192 | (1) |
|
Building a View with a Toolbar |
|
|
192 | (3) |
|
Linking the Toolbar Button to the View Controller |
|
|
195 | (1) |
|
Writing the Root View Controller Implementation |
|
|
196 | (5) |
|
Implementing the Content Views |
|
|
201 | (4) |
|
|
205 | (2) |
|
|
207 | (2) |
|
Chapter 7 Using Tab Bars and Pickers |
|
|
209 | (46) |
|
|
210 | (6) |
|
Delegates and Data Sources |
|
|
216 | (1) |
|
Creating the Pickers Application |
|
|
216 | (10) |
|
Creating the View Controllers |
|
|
216 | (1) |
|
Creating the Tab Bar Controller |
|
|
217 | (4) |
|
|
221 | (1) |
|
Implementing the Date Picker |
|
|
222 | (4) |
|
Implementing the Single-Component Picker |
|
|
226 | (7) |
|
|
226 | (4) |
|
Implementing the Data Source and Delegate |
|
|
230 | (3) |
|
Implementing a Multicomponent Picker |
|
|
233 | (11) |
|
|
233 | (1) |
|
Implementing the Controller |
|
|
233 | (3) |
|
Implementing Dependent Components |
|
|
236 | (8) |
|
Creating a Simple Game with a Custom Picker |
|
|
244 | (9) |
|
Preparing the View Controller |
|
|
244 | (1) |
|
|
244 | (1) |
|
Implementing the Controller |
|
|
245 | (4) |
|
Additional Details for Your Game |
|
|
249 | (4) |
|
|
253 | (2) |
|
Chapter 8 Introducing Table Views |
|
|
255 | (54) |
|
Understanding Table View Basics |
|
|
256 | (2) |
|
Using Table Views and Table View Cells |
|
|
256 | (1) |
|
Understanding Grouped and Plain Tables |
|
|
257 | (1) |
|
Implementing a Simple Table |
|
|
258 | (18) |
|
|
258 | (3) |
|
Implementing the Controller |
|
|
261 | (4) |
|
|
265 | (2) |
|
Using Table View Cell Styles |
|
|
267 | (4) |
|
|
271 | (1) |
|
|
272 | (2) |
|
Changing the Font Size and Row Height |
|
|
274 | (2) |
|
Customizing Table View Cells |
|
|
276 | (1) |
|
Adding Subviews to the Table View Cell |
|
|
277 | (1) |
|
Implementing a Custom Table Views Application |
|
|
277 | (13) |
|
Creating a UITableViewCell Subclass |
|
|
278 | (4) |
|
Loading a UITableViewCell from a XIB File |
|
|
282 | (8) |
|
Using Grouped and Indexed Sections |
|
|
290 | (17) |
|
|
290 | (1) |
|
|
291 | (1) |
|
Implementing the Controller |
|
|
292 | (4) |
|
|
296 | (1) |
|
|
297 | (8) |
|
|
305 | (2) |
|
|
307 | (2) |
|
Chapter 9 Adding Navigation Controllers to Table Views |
|
|
309 | (34) |
|
Understanding Navigation Controller Basics |
|
|
309 | (3) |
|
|
310 | (1) |
|
Using a Stack of Controllers |
|
|
311 | (1) |
|
Fonts: Creating a Simple Font Browser |
|
|
312 | (16) |
|
Seeing the Subcontrollers of the Fonts App |
|
|
313 | (2) |
|
Seeing the Fonts Application's Skeleton |
|
|
315 | (4) |
|
Creating the Root View Controller |
|
|
319 | (3) |
|
Doing the Initial Storyboard Setup |
|
|
322 | (1) |
|
First Subcontroller: Creating the Font List View |
|
|
323 | (2) |
|
Creating the Font List Storyboard |
|
|
325 | (3) |
|
Creating the Font Sizes View Controller |
|
|
328 | (14) |
|
Creating the Font Sizes View Controller Storyboard |
|
|
330 | (1) |
|
Implementing the Font Sizes View Controller Prepare for Segue |
|
|
330 | (1) |
|
Creating the Font Info View Controller |
|
|
331 | (1) |
|
Creating the Font Info View Controller Storyboard |
|
|
332 | (5) |
|
Adapting the Font List View Controller for Multiple Segues |
|
|
337 | (1) |
|
Creating My Favorite Fonts |
|
|
337 | (1) |
|
|
338 | (1) |
|
Implementing Swipe-to-Delete |
|
|
338 | (2) |
|
Implementing Drag-to-Reorder |
|
|
340 | (2) |
|
|
342 | (1) |
|
Chapter 10 Collection Views |
|
|
343 | (14) |
|
Creating the DialogViewer Project |
|
|
343 | (12) |
|
|
345 | (3) |
|
Configuring the View Controller |
|
|
348 | (1) |
|
|
349 | (2) |
|
|
351 | (2) |
|
Implementing the Header Views |
|
|
353 | (2) |
|
|
355 | (2) |
|
Chapter 11 Split Views and Popovers for iPad Apps |
|
|
357 | (26) |
|
Building Master-Detail Applications with UISplitViewController |
|
|
359 | (22) |
|
Understanding How the Storyboard Defines the Structure |
|
|
361 | (2) |
|
Understanding How Code Defines the Functionality |
|
|
363 | (4) |
|
Understanding How the Master-Detail Template Application Works |
|
|
367 | (2) |
|
Adding the President Data |
|
|
369 | (6) |
|
Creating Your Own Popover |
|
|
375 | (6) |
|
|
381 | (2) |
|
Chapter 12 App Customization with Settings and Defaults |
|
|
383 | (36) |
|
Exploring the Settings Bundle |
|
|
383 | (2) |
|
Creating the Bridge Control Application |
|
|
385 | (33) |
|
Creating the Bridge Control Project |
|
|
390 | (1) |
|
Working with the Settings Bundle |
|
|
391 | (17) |
|
Reading Settings in Your Application |
|
|
408 | (4) |
|
Changing Defaults from Your Application |
|
|
412 | (2) |
|
Registering Default Values |
|
|
414 | (1) |
|
|
415 | (2) |
|
Switching to the Settings Application |
|
|
417 | (1) |
|
|
418 | (1) |
|
Chapter 13 Persistence: Saving Data Between App Launches |
|
|
419 | (46) |
|
Your Application's Sandbox |
|
|
419 | (6) |
|
Getting the Documents and Library Directories |
|
|
423 | (1) |
|
Getting the tmp Directory |
|
|
424 | (1) |
|
|
425 | (1) |
|
|
425 | (1) |
|
Multiple-File Persistence |
|
|
425 | (1) |
|
|
425 | (8) |
|
Property List Serialization |
|
|
426 | (1) |
|
Creating the First Version of a Persistence Application |
|
|
427 | (6) |
|
|
433 | (8) |
|
|
433 | (1) |
|
|
434 | (1) |
|
Archiving and Unarchiving Data Objects |
|
|
435 | (1) |
|
The Archiving Application |
|
|
436 | (2) |
|
Using iOS's Embedded SQLite3 |
|
|
438 | (1) |
|
Creating or Opening the Database |
|
|
439 | (1) |
|
|
440 | (1) |
|
Creating the SQLite3 Application |
|
|
441 | (6) |
|
Linking to the SQLite3 Library |
|
|
441 | (6) |
|
|
447 | (16) |
|
Entities and Managed Objects |
|
|
448 | (3) |
|
The Core Data Application |
|
|
451 | (5) |
|
Modifying the AppDelegate.swift File |
|
|
456 | (7) |
|
|
463 | (2) |
|
Chapter 14 Graphics and Drawing |
|
|
465 | (26) |
|
|
466 | (1) |
|
The Quartz 2D Approach to Drawing |
|
|
466 | (8) |
|
Quartz 2D's Graphics Contexts |
|
|
466 | (1) |
|
|
467 | (3) |
|
|
470 | (1) |
|
Drawing Images in Context |
|
|
471 | (1) |
|
Drawing Shapes: Polygons, Lines, and Curves |
|
|
472 | (1) |
|
Quartz 2D Tool Sampler: Patterns, Gradients, and Dash Patterns |
|
|
472 | (2) |
|
The QuartzFun Application |
|
|
474 | (16) |
|
Creating the QuartzFun Application |
|
|
474 | (8) |
|
Adding Quartz 2D Drawing Code |
|
|
482 | (5) |
|
Optimizing the QuartzFun Application |
|
|
487 | (3) |
|
|
490 | (1) |
|
Appendix A An Introduction to Swift |
|
|
491 | (56) |
|
|
491 | (55) |
|
Playgrounds, Comments, Variables, and Constants |
|
|
493 | (3) |
|
Predefined Types, Operators, and Control Statements |
|
|
496 | (11) |
|
Arrays, Ranges, and Dictionaries |
|
|
507 | (5) |
|
|
512 | (5) |
|
|
517 | (5) |
|
|
522 | (5) |
|
|
527 | (6) |
|
|
533 | (1) |
|
|
533 | (2) |
|
|
535 | (1) |
|
|
536 | (3) |
|
|
539 | (1) |
|
|
540 | (1) |
|
Subclassing and Inheritance |
|
|
541 | (3) |
|
|
544 | (1) |
|
|
545 | (1) |
|
|
546 | (1) |
Index |
|
547 | |