HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
“Not many books have a single project that lives and evolves through the entire narrative. The reason not many books do this is because it is difficult to do well. Important toolkit features get shoehorned in weird places because the author didn’t do enough up-front design time. This book, though, takes you from design, to a prototype, to the Real Deal. And then it goes further.”
—Mark Dalrymple, cofounder of CocoaHeads, the international Mac and iPhone programmer community; author of Advanced Mac OS X Programming: The Big Nerd Ranch Guide
Learning iPad Programming, Second Edition, will help you master all facets of iPad programming with Apple’s newest tools. Its in-depth, hands-on coverage fully addresses the entire development process, from installing the iOS SDK through coding, debugging, submitting apps for Apple’s review, and deployment.
Extensively updated for Apple’s newest iOS features and Xcode 4.x updates, this book teaches iPad programming through a series of exercises centered on building PhotoWheel, a powerful personal photo library app. As you build PhotoWheel, you’ll gain experience and real-world insights that will help you succeed with any iPad development project.
Leading iOS developers Kirby Turner and Tom Harrington introduce the essentials of iOS development, focusing on features that are specific to iPad. You’ll find expert coverage of key topics many iOS development books ignore, from app design to Core Data. You’ll also learn to make the most of crucial iOS and Xcode features, such as Storyboarding and Automatic Reference Counting (ARC), and extend your app with web services and the latest iCloud synching techniques.
Learn how to
Download the free version of PhotoWheel from the App Store today! Import, manage, and share your photos as you learn how to build this powerful app.
Download Second Edition source code packaged in a .dmg here.
Download Second Edition source code packaged in a .zip here.
Learn to Program Your First iPad App
Download the sample pages (includes Chapter 1 and Index)
Foreword xxv
Preface xxix
Acknowledgments xlv
About the Authors xlvii
Part I: Getting Started 1
Chapter 1: Your First App 3
Creating the Hello World Project 3
Getting Text on the Screen 11
Say Hello 13
Summary 19
Chapter 2: Getting Started with Xcode 21
The IDE 21
Workspace Window 22
Preferences 29
Developer Documentation 37
Editors 38
Project Settings 40
Schemes 42
Organizer 43
Other Xcode Tools 44
Summary 45
Chapter 3: Getting Started with Interface Builder 47
Interface Builder 47
How Does IB Work? 48
Getting Hands-On Practice with IB 49
Connecting Your NIB to Your Code 61
Storyboards 70
Summary 70
Chapter 4: Getting Started with Objective-C 71
What Is Objective-C? 71
Hands-On Practice with Objective-C 72
Memory Management 93
Summary 95
Chapter 5: Getting Started with Cocoa 97
The Cocoa Stack 97
Foundation 99
UIKit 112
Common Design Patterns in Cocoa 121
Summary 123
Chapter 6: Provisioning Your iPad 125
About the iOS Provisioning Portal 125
The Provisioning Process: A Brief Overview 127
Setting Up Your Development Machine 130
Setting Up Your Device 138
Using the iOS Provisioning Portal 141
Summary 149
Chapter 7: App Design 151
Defining Your App 151
A Sample App Charter 156
UI Design Considerations 158
Mockups 164
Prototyping 171
Summary 173
Part II: Building PhotoWheel 175
Chapter 8: Creating a Master-Detail App 177
Building a Prototype App 177
A Closer Look 183
A Tour of UISplitViewController 189
Summary 195
Exercises 196
Chapter 9: Using Table Views 197
First Things First 197
A Closer Look 201
Working with a Table View 203
Summary 233
Exercises 234
Chapter 10: Using Collection and Custom Views 235
Collection Views 235
Custom Views 246
A Wheel View 248
A Carousel View 256
A Photo Wheel View Cell 263
Summary 268
Exercises 268
Chapter 11: Using Touch Gestures 269
Touch Gestures Explained 269
Custom Touch Gestures 275
Summary 283
Exercises 283
Chapter 12: Adding Photos 285
Two Approaches 285
Using the Image Picker Controller 286
Summary 299
Exercises 299
Chapter 13: Data Persistence 301
The Data Model 301
Building the Model with Core Data 302
Using Core Data in PhotoWheel 312
Adding Custom Code to Model Objects 321
Using SQLite Directly 335
Summary 336
Exercises 336
Chapter 14: Storyboarding in Xcode 337
What Is a Storyboard? 337
Storyboarding PhotoWheel 341
Summary 357
Exercises 357
Chapter 15: View Controllers and Segues 359
Implementing a View Controller 359
Container View Controllers 364
Segue 369
Customizing the Pop Transitions 381
Summary 385
Exercises 385
Chapter 16: Building the Main Screen 387
Reusing Prototype Code 388
Displaying Photo Albums 406
Managing Photo Albums 417
A Better Photo Album Thumbnail 430
Adding Photos 434
Displaying Photos 439
Summary 446
Exercises 446
Chapter 17: Creating a Photo Browser 447
Using the Scroll View 447
Launching the Photo Browser 456
Adding Chrome Effects 468
Zooming 474
Deleting a Photo 480
Summary 488
Exercise 488
Chapter 18: Supporting Device Rotation 489
How to Support Rotation 489
Customized Rotation 495
Launch Images 513
Summary 515
Exercises 516
Chapter 19: Printing with AirPrint 517
How Printing Works 517
Adding Printing to PhotoWheel 519
Summary 523
Exercises 524
Chapter 20: Sharing with Others 525
Sending Email 525
Activity View Controller 537
Summary 540
Exercises 540
Chapter 21: Web Services 541
The Basics 541
Flickr 543
One More Thing 575
What’s Missing 576
Summary 577
Exercises 577
Chapter 22: Syncing with iCloud 579
Syncing Made Simple 579
iCloud Concepts 580
Device Provisioning, Revisited 582
iCloud Considerations for PhotoWheel 586
Updating PhotoWheel for iCloud 588
Syncing Photos with iCloud 592
Going Further with iCloud 600
Summary 603
Exercises 603
Chapter 23: Producing a Slideshow with AirPlay 605
External Display Options 605
App Requirements for External Displays 606
External Display API 606
Attaching an External Display 607
Adding a Slideshow to PhotoWheel 609
Managing External Displays 613
Advancing to the Next Photo 617
Adding Slideshow User Interface
Controls 620
Updating the Photo Browser 622
Finishing Up 623
Summary 624
Exercises 624
Chapter 24: Visual Effects with Core Image 625
Core Image Concepts 625
Introducing CIFilter 627
Image Analysis 630
Adding Core Image Effects to PhotoWheel 633
Summary 651
Exercises 651
Chapter 25: Going Universal 653
Why Go Universal? 653
Making a Universal App 655
Pitfalls 659
Summary 661
Exercises 662
Part III: The Finishing Touches 663
Chapter 26: Debugging 665
Understand the Problem 665
Debugging Concepts 666
Debugging in Xcode 667
Debugging Example: External Display Code 675
When You Really Need NSLog 679
Profiling Code with Instruments 681
Summary 686
Chapter 27: Distributing Your App 689
Distribution Methods 689
Building for Ad Hoc Distribution 690
Building for App Store Distribution 694
The App Store Process 698
App Information for the App Store 700
App Store Assets 702
Using iTunes Connect 703
Submitting the App 705
Going Further 706
Summary 706
Chapter 28: The Final Word 707
What’s Next 708
Appendix: Installing the Developer Tools 709
Membership Has Its Privileges 709
Joining the iOS Developer Program 710
Which Program Type Is Right for You? 711
What You Need to Register 712
Installing Xcode 714
Index 717
The figures in Chapter 2 were published incorrectly; please download this PDF to see the correct versions of all of the figures.