Suchen und Finden
Service
iPhone and iPad Apps for Absolute Beginners
Rory Lewis
Verlag Apress, 2011
ISBN 9781430227014 , 336 Seiten
Format PDF, OL
Kopierschutz Wasserzeichen
Contents at a Glance
5
Table of Contents
6
Foreword: About the Author
10
Why you’ll relate to Dr. Lewis
10
Fast-Forward 17 Years
10
Past—Present—Future
11
Why Write This Book?
11
About the Contributing Authors
13
About the Technical Reviewer
14
Acknowledgments
15
Preface
16
What This Book Will Do For You
16
The Approach I Take
17
Chapter 1 Before We Get Started
18
Necessities and Accessories
18
What I Won’t Teach You
23
Computer Science: A Broad and Diverse Landscape
23
Why Purgatory Exists In Objective-C
24
Houston, We Have a Problem
24
How We’ll Visit Purgatory Every Now and Again
25
Looking Forward … Beginning iPhone 3 Development: Exploring the iPhone SDK
25
What You Will Learn
26
Creating Cool and Wacky Apps: Why I Teach This Way
26
Evangelizing to Your Grandmother … What You Coded Is Crucial!
27
How Does This All Work?
27
Our Road Map: Using Xcode and Interface Builder
29
Getting Ready For Your First iPhone/iPad Project
29
The Accompanying Screencasts
31
The Accompanying PDFs
32
Pretending Not to Know: The Art of De-Obfuscation
32
How We’ll Travel Through Each Step
32
Chapter 2: Blast-Off!
33
helloWorld_002 – a Navigation-based Application
54
helloWorld_003 – Modifying a Navigation-based App
64
Chapter 3: What’s Next?
69
§I: THE ROAD AHEAD
70
Introducing Chapter 4—An Introduction to the Code
70
Introducing Chapter 5—Buttons & Labels with Multiple Graphics
71
Introducing Chapter 6—Switch View with Multiple Graphics
72
Introducing Chapter 7—Dragging, Rotating, and Scaling
74
Introducing Chapter 8—Table Views, Navigation, and Arrays
75
Introducing Chapter 9—MapKit
76
§II: THE iPHONE AND THE iPAD
76
Do Apps Run on Both the iPad and the iPhone?
77
More Screen Space
78
Master-Detail
80
User Interface on iPad
80
Checking the Platform
81
Compatibility
81
§III: A LOOK UNDER THE HOOD
82
You’ve Said “Hello!” … but now, INDIO!
83
Model-View-Controller
83
Chapter 4: An Introduction to the Code
86
004_helloWorld: Buttons with Graphics
87
Digging the Code
104
Nibs, Zibs, and Xibs
104
Methods
105
Chapter 5: Buttons & Labels with Multiple Graphics
108
helloWorld_005: a View-Based Application
108
Preliminaries
109
Xcode – Beginning a New Project
112
Understanding IBOutlets
114
Pointers
116
Properties: Management & Control
118
Adding IBActions
120
Coding the Implementation File
121
Providing for Synthesis
123
Interface Builder: Making the Connections
125
Final Step: File’s Owner & uiImageView
133
Digging the Code
137
IBOutlets and IBActions
137
More About Pointers
138
In the Chapter Ahead
139
Chapter 6: Switch View with Multiple Graphics
140
einSwitch_001—a Window-Based Application
143
Preliminaries
143
Name your Project “einSwitch01”
148
Create the 1st UIViewController Subclass
152
Create the Ein1Controller
153
Check Header and Implementation Files
154
Create the Ein2Controller
154
Make Sure Images Are Embedded
155
Save Einstein2View.xib
156
Drag the Images into Xcode
157
Assign your Icon in the “plist”
158
Code the AppViewDelegate
159
Working SwitchView
161
SwitchViewController and AppDelegate
163
SwitchViewController Header File
167
Ready for Lazy Load—Implementation File
170
A Note about Comments and Lazy Loads
171
Copy Contents of SwitchViewController.txt
173
A Note about Apple’s Boilerplate Implementation File
174
Working on the .xib Files
176
Select the File’s Owner
178
Drag a View onto the Screen
178
Start Working on the Einstein#View.xib Files
182
Repeat Process for Second Image
186
einSwitch_002—a Tab-Bar Application
191
einSwitch_003—a Window-Based Application
206
Digging … Your Brain
222
Chapter 7: Dragging, Rotating, and Scaling
223
DragRotateAndScale—a View-Based Application
224
Preliminaries
225
Starting the DragRotateAndScale App
225
Creating a Custom UIImageView Subclass
227
Overriding – initWithImage in TransformView.m
229
Creating Touch-Handling Stubs
230
Translating in touchesMoved
232
Making Use of TransformView
234
Creating a TransformView
234
Preparing TransformView for Rotation and Scaling
239
Helper Methods
240
Adding to “-touchesBegan”
241
Modifying -touchesMoved
243
Digging the Code
246
Gesture Support and the iPad
247
Chapter 8: Table Views, Navigation, and Arrays
249
How Shall We Proceed?
252
Table Views and Navigation Stacks
252
Food: Following the App Store Model
253
Starting the Food App
253
Adding the Category Names Array in RootViewController.h
255
Creating the Categories Array in -viewDidLoad
256
Setting Up Table View Data Source Methods
257
Table View Delegation
258
Setting up FoodTableViewController
259
Creating the Convenience Constructor for the FoodTableViewController
262
Data Source and Delegation for the FoodTableViewController
263
Creating the FoodViewController Class
264
The FoodViewController Header File
265
The FoodViewController Convenience Constructor
266
Setting Up FoodViewController, -viewDidLoad, and the (.xib)
266
Icon File
268
Testing the App
269
Digging the Code
271
Memory Management
271
Reuse Identifiers
273
Chapter 9: MapKit
274
A Little about Frameworks
275
Important Things to Know
276
Preinstalled MapKit Apps
276
Find Locations
277
Get Directions
278
See Which Way You’re Facing
279
See Traffic
280
Search for a Location
281
Change Your View
282
Cool and Popular MapKit Apps to Inspire You
283
MapKit_01: A View-Based Application
284
Possible Prepping for the App
284
Preliminaries
286
A New View-Based Template
286
Adding the Annotation File
287
It’s Already Working!
288
Check It Out—the iPad Simulator
289
Make It Look a Little Bit Better
290
Dealing with the Implementation
291
Coding the myPos.h File
297
The myPos.m File
298
The AppDelegate Files
299
Connect MapView with MKMapView
300
Digging My Students’ MapKit Code
303
Parsing to MapKit from the Internet
303
MapKit Parsing
306
Three MapKit Final Projects: CS-201 iPhone Apps, Objective-C
308
Final Project—Example 2
317
Biographical Info—Example 3, Satish Rege
320
Zoom Out … Seeing the Big Picture
323
Index
325