If you’ve got incredible i OS ideas, get this book and bring them to life!
i OS 7 represents the most significant update to Apple’s mobile operating system since the first i Phone was released, and even the most seasoned app developers are looking for information on how to take advantage of the latest i OS 7 features in their app designs. That’s where i OS App Development For Dummies comes in! Whether you’re a programming hobbyist wanting to build an app for fun or a professional developer looking to expand into the i OS market, this book will walk you through the fundamentals of building a universal app that stands out in the i OS crowd.
- Walks you through joining Apple’s developer program, downloading the latest SDK, and working with Apple’s developer tools
- Explains the key differences between i Pad and i Phone apps and how to use each device’s features to your advantage
- Shows you how to design your app with the end user in mind and create a fantastic user experience
- Covers using nib files, views, view controllers, interface objects, gesture recognizers, and much more
There’s no time like now to tap into the power of i OS – start building the next big app today with help from i OS App Development For Dummies!
Innehållsförteckning
Introduction 1
A Bit of History 1
The i Phone stands alone 2
Enter the App Store 2
The i Pad joins the party 3
The Plan for This Book 3
i OS and Xcode Game Changers 4
About This Book 5
Conventions Used in This Book 5
Icons Used in This Book 6
Foolish Assumptions 7
How This Book Is Organized 7
Part I: Getting Started 8
Part II: Building Road Trip 8
Part III: Getting Your Feet Wet: Basic Functionality 8
Part IV: The Model and the App Structure 9
Part V: Adding the App Content 9
Part VI: The Part of Tens 9
Beyond the Book 10
Where to Go from Here 10
Part I: Getting Started 11
Chapter 1: What Makes a Great i OS App 13
Figuring Out What Makes a Great i OS App 14
Making your app work well 14
Handling networking, social media, and location 15
Designing a powerful and intuitive interface that disappears 15
Using the i OS Platform to the Fullest 16
Exploiting advantages of the system 16
Accessing the Internet 17
Knowing the location of the user 18
Tracking orientation and motion 18
Tracking users’ fingers on the screen 19
Playing content 19
Accessing information from Apple’s apps 19
Copying, cutting, and pasting between apps 20
Multitasking, background processing, and notifications 20
Living large on the big screen 21
Embracing Device Limitations 21
Designing for fingers 22
Balancing memory and battery life 22
Why Develop i OS Apps? 23
Developing with Apple’s Expectations in Mind 24
Thinking About You, Apps, and Money 25
Enter the Cloud 26
Developing an App the Right Way Using the Example App in This Book 27
What’s Next 27
Chapter 2: Getting to Know the SDK 29
Developing Using the SDK 29
Using Xcode to Develop an App 30
Creating an Xcode project 31
Developing the app 31
The Workspace Window 33
Workspace areas 34
Displaying an area’s content 36
The toolbar and Tab bar 40
The Organizer window 42
Chapter 3: The Nuts and Bolts of an Xcode Project 45
Creating Your Project 45
Exploring Your Project 50
The project 50
The Project editor 50
The Project navigator 53
Setting Your Xcode Preferences 57
Building and Running Your Application 59
Building an app 61
The i Pad’s Split views 63
The Log navigator 64
Running in the Simulator 66
Interacting with your simulated hardware 66
Making gestures 67
Uninstalling apps and resetting your device 68
Living with the Simulator’s limitations 69
Using Asset Catalogs 70
Adding the Image and Sound Resources and an App Icon 74
Part II: Building Road Trip 77
Chapter 4: Storyboards and the User Experience 79
Introducing the Storyboard 80
Telling your story 81
Working with object graphs 83
Defining What You Want an App to Do: The Road Trip App 84
Creating the Application Architecture 88
What You Add Where 89
Using Frameworks 90
Using Design Patterns 91
The i OS design patterns 92
The Model-View-Controller (MVC) design pattern 92
Working with Windows and Views 95
Looking out the window 95
Admiring the view 96
The kinds of views you use 97
View Controllers — the Main Storyboard Players 101
What About the Model? 104
It’s Not That Neat 105
Taking a Look at Other Frameworks 106
The Foundation framework 106
The Core Graphics framework 106
Even more frameworks 107
Understanding the MVC in the Project 107
Chapter 5: Creating the Road Trip User Interface 111
Creating Your User Interface in the i Pad Storyboard 111
It’s about the view controller 112
Using Interface Builder to add the user elements 113
Working within the Utility Area 115
Inspector and Quick Help pane 115
Library pane 116
Understanding i Pad Navigation 117
Adding a New View Controller 121
Danger Will Robinson 128
Adding an identifier to the view controller 129
View Layout 130
Adding the User Interface Objects 131
Autosizing with Auto Layout 136
Adding the Test Drive button 141
Massaging the Template Code 144
Getting Rid of Warnings 148
Creating the i Phone User Interface 148
Chapter 6: The Runtime, Managing Memory, and Using Properties 151
Stepping Through the App Life Cycle 152
UIApplication Main 153
Handling events while your application is executing 158
Knowing what to do when the normal processing of your application is interrupted 160
An overview of the view controller life cycle 163
Working within the Managed Memory Model Design Pattern 164
Understanding memory management 165
Using reference counting 165
Automatic Reference Counting (ARC) 167
Working with variable types according to ARC 169
Understanding the deadly retain cycle 170
Observing Low-Memory Warnings 172
The did Receive Memory Warning method 172
The application Did Receive Memory Warning: method 172
The UIApplication Did Receive Memory Warning Notification: notification 173
Picking the right memory-management strategy for your application 173
Customizing the Behavior of Framework Classes 174
Subclassing 174
The Delegation pattern 175
Understanding Declared Properties 176
What comprises a declared property 176
Using dot syntax 177
Setting attributes for a declared property 178
Writing your own accessors 180
Accessing instance variables with accessors 181
Hiding Instance Variables 181
Chapter 7: Working with the Source Editor 183
Navigating in the Xcode Source Editors 183
Using the Jump bar 186
Organizing your code using the #pragma mark statement 190
Using the Xcode Source Editor 190
Using Live Issues and Fix-it 192
Compiler warnings 193
The Issue navigator 193
Accessing Documentation 195
Getting Xcode help 195
The Organizer window 198
The Help menu 199
Finding and Searching in Your Project 199
Using the Find command to locate an item in a file 199
Using the Search navigator to search your project or framework 200
Using the Symbol navigator 201
You’re Finally Ready to Write Code! 202
Part III: Getting Your Feet Wet: Basic Functionality 203
Chapter 8: It’s (Finally) T ime to Code 205
Checking for Network Availability 205
Downloading the Reachability sample 205
Adding the code to check for reachability 208
Exploring the Changes in i OS 7 211
The dated interface 211
Losing the content 212
Setting the Master View Controller Title 213
Understanding Autorotation 214
Writing Bug-Free Code 215
Working in the Debug area and Debug navigator 216
Managing breakpoints 218
What you’ll find in the Debug area 222
What you’ll find in the Debug navigator 223
Displaying variables in the Source editor 224
Tiptoeing through your program 225
Chapter 9: Adding Outlets and Actions to Your Road Trip Code 227
Using Custom View Controllers 228
Adding the custom view controller 228
Setting up the Test Drive Controller in the Main Storyboard for i Pad 229
Understanding Outlets 231
Adding Outlets 232
Opening the Assistant editor 232
Creating the outlet 234
The Connections inspector 237
Working with the Target-Action Design Pattern 239
Using the Target-Action pattern: It’s about controls 239
Adding an action 241
How Outlets and Actions Work 244
Update the i Phone storyboard file 244
Chapter 10: Adding Animation and Sound to Your App 247
Understanding i OS Animation 248
View geometry and coordinate systems 248
Points versus pixels 248
A view’s size and position 249
Working with data structures 250
Coordinating Auto Layout, Frames, and Constraints 250
Animating a View 251
Finally, More Code 252
Implementing the test Drive Method 252
Understanding Block Objects 256
Rotating the Object 259
Working with Audio 261
Tracking Touches 269
Animating a Series of Images “In Place” 272
i Phone versus i Pad 273
Part IV: The Model and the App Structure 275
Chapter 11: The Trip Model 277
What the Model Contains 277
Adding the Model Data 278
Using property lists 278
Adding a property list to your project 280
Adding the First Two Model Classes 290
Understanding the Trip Interface 292
Implementing the Trip Class 294
Initializing objects 296
Invoking the superclass’s init method 297
Initializing instance variables 298
Returning self 299
Initializing the Destination Class 300
Creating the Trip Object 303
More Debugger Stuff 305
Chapter 12: Implementing the Master View Controller 309
Setting Up a Custom View Controller for the i Pad 309
Adding a Background Image and Title 319
Updating the i Phone Storyboard File 321
Chapter 13: Working with Split View Controllers and the Master View 323
The Problem with Using a Navigation Controller in Detail View 323
Using a Navigation Controller in the Master View 326
Adding a Gesture Recognizer 330
The Split View Controller 333
The UISplit View Controller delegate 335
Localization 340
Back to the main feature 340
Adding the Toolbar 346
Adding the button when the view controller is replaced 350
A Few More Tweaks to the Master View Controller 354
And (a Little Extra) One More Thing 355
Don’t Forget the i Phone 356
Chapter 14: Finishing the Basic App Structure 357
Extending the i Pad Storyboard to Add More Functionality to Your App 358
Adding the Weather view controller 358
Adding the Events controller 364
Adding the remaining controllers 367
Changing the Split View Controller to a Detail View Controller Relationship 368
Repeat for i Phone 372
Part V: Adding the App Content 373
Chapter 15: How’s the Weather? Working with Web Views 375
The Plan 375
The i Pad storyboard 376
The i Phone storyboard 377
Setting Up the Weather Controller 379
Adding the custom view controller 379
Setting Up Weather Controller in the Main_i Pad.storyboard file 380
The Weather Controller 385
Managing links in a Web view 388
More Opportunities to Use the Debugger 392
Unrecognized selector sent to instance 392
Repeat for the i Phone Storyboard 393
Adding the Weather Controller to the i Phone storyboard file 393
Test in the i Phone Simulator 394
Chapter 16: Displaying Events Using a Page View Controller 395
The Plan 396
Setting Up the Events Controller 397
Adding the custom view controller 397
Setting up the Events Controller in the Main Storyboard 398
Adding and setting up the Event Page Controller in the Main Storyboard 399
Extending the Trip Model 401
Adding the Events Class 403
The Events Controller and Its Page View Controller 406
Data sources and delegates 406
Data source 407
Delegate 407
The Events Controller 407
The Event Page Controller 412
Adding Events Support to the i Phone Storyboard 415
Chapter 17: Finding Your Way 417
The Plan 418
Setting Up the Map Controller 419
Adding the custom view controller 420
Setting up the Map Controller in the Main_i Pad.Storyboard 420
Test 426
Putting Map Kit through Its Paces 428
MKMap View 428
Enhancing the map 429
Changing the Map Type 435
Adding Annotations 437
Creating the annotation 437
Displaying the map title and annotations 441
Going to the Current Location 446
Fixing the Status Bar 451
Update the i Phone Storyboard 454
Chapter 18: Geocoding 455
Understanding Geocoding on the i Pad 455
Reverse Geocoding 458
Chapter 19: Finding a Location 465
Setting Up the Find Controller 465
Adding the custom view controller 466
Setting up Find Controllerin the Main_i Pad File 466
Implementing the Find Controller 469
Adding the Map View 469
Getting the text 470
Disabling cell highlighting 477
Finding the Location 477
Making the Map Title the Found Location 484
Adding the Find Controller to the i Phone Storyboard 485
Chapter 20: Selecting a Destination 487
The Plan 487
Setting Up the Destination Controller for the i Pad Storyboard 488
Adding the custom view controller 488
Setting up the Destination Controller in the Main_i Pad.storyboard 489
Adding a Modal View 494
Implementing a Table View 497
Creating the Table View 498
Adding sections 499
Displaying the cell 501
Working with user selections 503
Saving the Destination Choice and Selecting a Destination 511
Displaying the Destination table 516
Testing 517
Adding Destination Support to the i Phone Storyboard 518
A Word about Adding Settings 519
What’s Next? 519
Part VI: The Part of Tens 521
Chapter 21: Ten Ways to Be Successful with Apps 523
Make a Million Dollars in a Week 523
Build a Portfolio 524
Build App Icons 524
Design User Interfaces 524
Build Back Ends 525
Socialize with Apps 525
Talk About Apps with People Who Want Them 525
Promote Apps 525
Provide Support to Users 526
Fix Bugs 526
Chapter 22: Ten Ways to Be a Happy Developer 527
Keep Things Loosely Coupled 527
Remember Memory 528
Don’t Reinvent the Wheel 528
Understand State Transitions 529
Do the Right Thing at the Right Time 530
Avoid Mistakes in Error Handling 530
Use Storyboards 531
Remember the User 531
Keep in Mind That the Software Isn’t Finished Until the Last User Is Dead 531
Keep It Fun 531
Index 533
Om författaren
Jesse Feiler is a developer, consultant, and author specializing in Apple technologies. He is the creator of Minutes Machine for i Pad, the meeting management app, and Saranac River Trail and is heard regularly on WAMC Public Radio for the Northeast’s The Roundtable.