For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
This book was purchased by zhang-yi-chi@hotmail.com
iv
Contents at a Glance
Contents .............................................................................................................. v
About the Authors ............................................................................................. xiv
About the Technical Reviewer ........................................................................... xv
Acknowledgments ............................................................................................ xvi
Preface ............................................................................................................ xvii
■Chapter 1: Welcome to the Jungle .................................................................. 1
■Chapter 2: Appeasing the Tiki Gods .............................................................. 13
■Chapter 3: Handling Basic Interaction ........................................................... 45
■Chapter 4: More User Interface Fun .............................................................. 69
■Chapter 5: Autorotation and Autosizing ...................................................... 113
■Chapter 6: Multiview Applications .............................................................. 133
■Chapter 7: Tab Bars and Pickers ................................................................. 163
■Chapter 8: Introduction to Table Views ....................................................... 217
■Chapter 9: Navigation Controllers and Table Views .................................... 277
■Chapter 10: Storyboards ............................................................................. 353
■Chapter 11: iPad Considerations ................................................................. 381
■Chapter 12: Application Settings and User Defaults .................................... 407
■Chapter 13: Basic Data Persistence ............................................................ 445
■Chapter 14: Hey! You! Get onto iCloud! ....................................................... 493
■Chapter 15: Grand Central Dispatch, Background Processing, and You ..... 525
■Chapter 16: Drawing with Quartz and OpenGL ............................................ 563
■Chapter 17: Taps, Touches, and Gestures ................................................... 603
■Chapter 18: Where Am I? Finding Your Way with Core Location ................. 633
■Chapter 19: Whee! Gyro and Accelerometer! .............................................. 645
■Chapter 20: The Camera and Photo Library ................................................ 673
■Chapter 21: Application Localization ........................................................... 685
■Chapter 22: Where to Next? ......................................................................... 705
Index ............................................................................................................... 711
1
Chapter
Welcome to the Jungle
So, you want to write iPhone, iPod touch, and iPad applications? Well, we can’t say that
we blame you. iOS, the core software of all of these devices, is an exciting platform that
has been seeing explosive growth since it first came out in 2007. The rise of the mobile
software platform means that people are using software everywhere they go. With the
release of iOS 5, and the latest incarnation of the iOS software development kit (SDK),
things have only gotten better and more interesting.
What This Book Is
This book is a guide to help you get started down the path to creating your own iOS
applications. Our goal is to get you past the initial learning curve, to help you understand
the way iOS applications work and how they are built.
As you work your way through this book, you will create a number of small applications,
each designed to highlight specific iOS features and show you how to control or interact
with those features. If you combine the foundation you’ll gain through this book with
your own creativity and determination, and then add in the extensive and well-written
documentation provided by Apple, you’ll have everything you need to build your own
professional iPhone and iPad applications.
TIP: Dave, Jack, and Jeff have a forum set up for this book. It’s a great place to meet like-
minded folks, get your questions answered, and even answer other people’s questions. The
forum is at http://iphonedevbook.com. Be sure to check it out!
What You Need
Before you can begin writing software for iOS, you’ll need a few items. For starters,
you’ll need an Intel-based Macintosh running Lion (OS X 10.7) or later. Any recent Intel-
based Macintosh computer—laptop or desktop—should work just fine.
1
CHAPTER 1: Welcome to the Jungle
2
You’ll also need to sign up to become a registered iOS developer. Apple requires this
step before you’re allowed to download the iOS SDK.
To sign up as a developer, just navigate to
http://developer.apple.com/ios/. That
will bring you to a page similar to the one shown in Figure 1–1.
Figure 1–1. Apple’s iOS Dev Center web site
- 1
- 2
前往页