You are previewing Beginning iPhone 4 Development: Exploring the iOS SDK.
O'Reilly logo
Beginning iPhone 4 Development: Exploring the iOS SDK

Book Description

Beginning iPhone 4 Development is here! The authors of the bestselling Beginning iPhone 3 Development are back, with the same excellent material completely updated for iOS 4 and written from the ground up using the latest version of Apple's Xcode 3. All source code has been updated to use the latest Xcode templates and current APIs, and all-new screenshots show Xcode 3 in action.

Beginning iPhone 4 Development is a complete course in iOS 4 apps development. You'll master techniques that work on iPhone, iPad, and iPod touch. We start with the basics, showing you how to download and install the tools you'll need, and how to create your first simple application. Next you'll learn to integrate all the interface elements iOS users have come to know and love, such as buttons, switches, pickers, toolbars, and sliders. You'll master a variety of design patterns, from the simplest single view to complex hierarchical drill-downs. The confusing art of table building will be demystified, and you'll learn techniques to save and retrieve your data using SQLite, iPhone's built-in database management system and Core Data, the standard for persistence that Apple brought to iOS with the release of SDK 3.

And there's much more! You'll learn to draw using Quartz 2D and OpenGL ES, add multitouch gestural support (pinches and swipes) to your applications, and work with the camera, photo library, accelerometer, and built-in GPS. You'll discover the fine points of application preferences and learn how to localize your apps for multiple languages. You'll also learn how to use the new concurrency APIs included in iOS 4, and make robust multithreaded applications using Grand Central Dispatch.

  • The iPhone 4 update to the best-selling and most recommended book for Cocoa touch developers

  • Written in an accessible, easy-to-follow style

  • Full of useful tips and techniques to help you become an iOS pro

NOTE: For iPhone 4S or iOS 5 apps development, please instead check out the next edition of this book, Beginning iOS 5 Development - now available.

What you'll learn

  • Everything you need to know to develop your own best-selling iPhone and iPad apps

  • Best practices for optimizing your code and delivering great user experiences

  • How to create "universal" apps for both iPhone and iPad

Who this book is for

Anyone who wants to start developing for iPhone, iPad, and iPod touch.

You can discover more about this book, download source code, and find support forums at the book's companion site, at www.iphonedevbook.com.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About The Authors
  6. About The Technical Reviewer
  7. Acknowledgments
  8. Preface
  9. Chapter 1: Welcome to the Jungle
    1. What This Book Is
    2. What You Need
    3. What's Different About Coding for iOS?
    4. What's in This Book
    5. What's New in This Update?
    6. Are You Ready?
  10. Chapter 2: Appeasing the Tiki Gods
    1. Setting Up Your Project in Xcode
    2. Introducing Interface Builder
    3. Some iPhone Polish—Finishing Touches
    4. Bring It on Home
  11. Chapter 3: Handling Basic Interaction
    1. The Model-View-Controller Paradigm
    2. Creating Our Project
    3. Creating the View Controller
    4. Using the Application Delegate
    5. Editing MainWindow.xib
    6. Editing Button_FunViewController.xib
    7. Bring It on Home
  12. Chapter 4: More User Interface Fun
    1. A Screen Full of Controls
    2. Active, and Passive Controls
    3. Creating the Application
    4. Implementing the Image View and Text Fields
    5. Closing the Keyboard
    6. Implementing the Slider and Label
    7. Implementing the Switches, Button, and Segmented Control
    8. Implementing the Action Sheet and Alert
    9. Spiffing Up the Button
    10. Being a Good Memory Citizen
    11. Crossing the Finish Line
  13. Chapter 5: Autorotation and Autosizing
    1. The Mechanics of Autorotation
    2. Handling Rotation Using Autosize Attributes
    3. Restructuring a View When Rotated
    4. Swapping Views
    5. Rotating Out of Here
  14. Chapter 6: Multiview Applications
    1. Common Types of Multiview Apps
    2. The Architecture of a Multiview Application
    3. Building View Switcher
    4. Switching Off
  15. Chapter 7: Tab Bars and Pickers
    1. The Pickers Application
    2. Delegates and Data Sources
    3. Setting Up the Tab Bar Framework
    4. Implementing the Date Picker
    5. Implementing the Single-Component Picker
    6. Implementing a Multicomponent Picker
    7. Implementing Dependent Components
    8. Creating a Simple Game with a Custom Picker
    9. Final Spin
  16. Chapter 8: Introduction to Table Views
    1. Table View Basics
    2. Implementing a Simple Table
    3. Customizing Table View Cells
    4. Grouped and Indexed Sections
    5. Implementing a Search Bar
    6. Putting It All on the Table
  17. Chapter 9: Navigation Controllers and Table Views
    1. Navigation Controllers
    2. Nav, a Hierarchical Application in Six Parts
    3. Breaking the Tape
  18. Chapter 10: iPad Considerations
    1. Split Views and Popovers
    2. Here Come the Presidents
    3. iPad Wrap-Up
  19. Chapter 11: Application Settings and User Defaults
    1. Getting to Know Your Settings Bundle
    2. The AppSettings Application
    3. Beam Me Up, Scotty
  20. Chapter 12: Basic Data Persistence
    1. Your Application's Sandbox
    2. File-Saving Strategies
    3. Using Property Lists
    4. Archiving Model Objects
    5. Using iOS's Embedded SQLite3
    6. Using Core Data
    7. Persistence Rewarded
  21. Chapter 13: Grand Central Dispatch, Background Processing, and You
    1. Grand Central Dispatch
    2. Introducing SlowWorker
    3. Threading Basics
    4. Units of Work
    5. GCD: Low-Level Queueing
    6. Background Processing
    7. Grand Central Dispatch, Over and Out
  22. Chapter 14: Drawing with Quartz and OpenGL
    1. Two Views of a Graphical World
    2. The Quartz Approach to Drawing
    3. The QuartzFun Application
    4. The GLFun Application
    5. Drawing to a Close
  23. Chapter 15: Taps, Touches, and Gestures
    1. Multitouch Terminology
    2. The Responder Chain
    3. The Multitouch Architecture
    4. Detecting Touches
    5. Detecting Swipes
    6. Detecting Multiple Taps
    7. Detecting Pinches
    8. Creating and Using Custom Gestures
    9. Garçon? Check, Please!
  24. Chapter 16: Where Am I? Finding Your Way with Core Location
    1. The Location Manager
    2. The Location Manager Delegate
    3. Trying Out Core Location
    4. Wherever You Go, There You Are
  25. Chapter 17: Whee! Gyro and Accelerometer!
    1. Accelerometer Physics
    2. Don't Forget Rotation
    3. Core Motion and the Motion Manager
    4. Detecting Shakes
    5. Accelerometer As Directional Controller
    6. Rolling On
  26. Chapter 18: iPhone Camera and Photo Library
    1. Using the Image Picker and UIImagePickerController
    2. Implementing the Image Picker Controller Delegate
    3. Road Testing the Camera and Library
    4. It's a Snap!
  27. Chapter 19: Application Localization
    1. Localization Architecture
    2. Strings Files
    3. Real-World iOS: Localizing Your Application
    4. Auf Wiedersehen
  28. Chapter 20: Where to Next?
    1. Getting Unstuck
    2. Conferences
  29. Index