You are previewing iPhone SDK Application Development.
O'Reilly logo
iPhone SDK Application Development

Book Description

This practical book offers the knowledge and code you need to create cutting-edge mobile applications and games for the iPhone and iPod Touch, using Apple's iPhone SDK. iPhone SDK Application Development introduces you to this development paradigm and the Objective-C language it uses with numerous examples, and also walks you through the many SDK frameworks necessary for designing full-featured applications. This book will help you:

  • Design user interface elements with Interface Builder and the UI Kit framework

  • Create application controls, such as windows and navigation bars

  • Build and manage layers and transformations using Core Graphics and Quartz Core

  • Mix and play sound files using AVFoundation, and record and play back digital sound streams using Audio Toolbox

  • Handle network programming with the CFNetwork framework

  • Use the Core Location framework to interact with the iPhone's GPS

  • Add movie players to your application

iPhone SDK Application Development will benefit experienced developers and those just starting out on the iPhone. Important development concepts are explained thoroughly, and enough advanced examples are provided to make this book a great reference once you become an expert.

Table of Contents

  1. iPhone SDK Application Development
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. Foreword
    4. Preface
      1. Audience for This Book
      2. Organization of the Material
      3. Conventions Used in This Book
      4. Using Code Examples
      5. Legal Disclaimer
      6. Safari® Books Online
      7. We’d Like to Hear from You
      8. Acknowledgments
    5. 1. Getting Started with the iPhone SDK
      1. Anatomy of an Application
        1. Underneath Xcode
      2. Installing the iPhone SDK
        1. What You’ll Need
          1. Apple developer key
          2. An iPhone
        2. The iPhone Simulator
        3. Downloading and Installing the iPhone SDK
      3. Provisioning an iPhone
      4. Building and Installing Applications
        1. Model-View-Controller
        2. Application Templates
        3. Xcode Project Layout
        4. Prototypes
        5. Adding Frameworks
        6. Setting the Active SDK
        7. Building an Application
        8. Installing an Application
      5. Transitioning to Objective-C
        1. Messaging
        2. Class and Method Declarations
          1. The “id” data type
          2. Imports
          3. Interface declaration
          4. Methods
        3. Implementation
        4. Properties
        5. Protocols
        6. Categories
        7. Posing
        8. Additional Resources
    6. 2. Interface Builder: Xcode’s GUI for GUIs
      1. Windows, Views, and View Controllers
      2. Existing Templates
      3. New Templates
      4. User Interface Elements
        1. Controllers
        2. Data Views
        3. Inputs and Values
        4. Windows, Views, and Bars
      5. The Inspector
      6. Designing a UI
        1. The Window
        2. The View Controller
        3. Views
        4. Connecting the Views
        5. Adding Linkage to Code
      7. Removing Interface Builder from a Project
    7. 3. Introduction to UI Kit
      1. Basic User Interface Elements
      2. Windows and Views
        1. Creating a Window and View
        2. Displaying the View
        3. HelloView: Most Useless Application Ever
        4. What’s Going On
        5. Deriving from UIView
        6. HelloWorld: The Traditionally Useless Application
        7. What’s Going On
      3. View Controllers
        1. Creating a View Controller
        2. Loading from Interface Builder
        3. Orientation Changes
        4. Disposing of a View Controller
        5. ControllerDemo: Hello World, View Controller Style
        6. What’s Going On
        7. Further Study
      4. Text Views
        1. Creating a Text View
          1. Editing
          2. Alignment
          3. Font and size
          4. Text color
          5. Colors from Core Graphics
        2. Assigning Content
        3. Displaying HTML
        4. SourceReader: Web Page Source Code Reader
        5. What’s Going On
        6. Further Study
      5. Navigation Bars and Controllers
        1. Creating a Navigation Controller
        2. Navigation Controller Properties
          1. Setting the title
          2. Buttons, styles, and actions
          3. Navigation bar style
        3. Adding a Segmented Control
        4. Adding a Toolbar
          1. Image and text buttons
          2. System buttons
          3. Custom view buttons
          4. Creating the toolbar
          5. Sizing
          6. Toolbar style
        5. PageDemo: Page Navigation Exercise
        6. What’s Going On
        7. Further Study
      6. Transition Animations
        1. Creating a Transition
          1. Timing function
          2. Animation types
          3. Duration
        2. Attaching a Transition
        3. FlipDemo: Page-Flipping Transitions
        4. What’s Going On
        5. Further Study
      7. Action Sheets and Alerts
        1. Alerts
        2. Action Sheets
        3. Dismissing an Action Sheet
        4. EndWorld: Ending the World (with Confirmation)
        5. What’s Going On
        6. Further Study
      8. Table Views and Controllers
        1. Creating the Table
          1. Subclassing UITableViewController
        2. Table Cells
          1. Display text
          2. Alignment
          3. Font and size
          4. Text color
          5. Images
          6. Selection style
          7. Labels
          8. Disclosures
        3. Implementing Multiple Select
        4. Editing and Swipe-to-Delete
        5. Reloading Tables
        6. TableDemo: Simple File Browser
        7. What’s Going On
        8. Further Study
      9. Status Bar Manipulation
        1. Hiding the Status Bar
        2. Status Bar Style
        3. Status Bar Orientation
      10. Application Badges
        1. Displaying an Application Badge
        2. Removing an Application Badge
        3. Further Study
      11. Application Services
        1. Suspending and Resuming
        2. Program Termination
      12. Invoking Safari
      13. Initiating Phone Calls
    8. 4. Multi-Touch Events and Geometry
      1. Introduction to Geometric Structures
        1. CGPoint
        2. CGSize
        3. CGRect
          1. Containment and intersection
          2. Edge and center detection
      2. Multi-Touch Events Handling
        1. UITouch Notifications
        2. UIEvent
        3. Events Handling
        4. Example: Tap Counter
        5. Example: Tap and Drag
        6. Processing Multi-Touch
        7. PinchMe: Pinch Tracking
        8. TouchDemo: Multi-Touch Icon Tracking
        9. What’s Going On
        10. Further Study
    9. 5. Layer Programming with Quartz Core
      1. Understanding Layers
        1. Layer Hierarchies
        2. Size and Offset
        3. Arrangement and Display
        4. Rendering
        5. Transformations
        6. Layer Animations
        7. Layer Transformations
        8. BounceDemo: Layer Fun
        9. What’s Going On
        10. Further Study
    10. 6. Making a Racket: Audio Toolbox and AVFoundation
      1. AVFoundation Framework
        1. The Audio Player
        2. Player Properties
        3. Playing Sounds
        4. Delegate Methods
        5. Metering
      2. AVMeter: Build a VU Meter
        1. What’s Going On
        2. Further Study
      3. Audio Services
        1. What’s Going On
      4. Audio Queues
        1. Audio Queue Structure
        2. Provisioning Audio Output
        3. Sound Buffers
        4. Callback Function
        5. Volume Control
        6. Example: PCM Player
        7. What’s Going On
        8. Further Study
      5. Recording Sound
        1. Audio Queue Structure
        2. Provisioning Audio Input
        3. Sound Buffers
        4. Callback Function
        5. Accessing Raw Data
        6. Writing to a File
        7. Example: Sound Recorder
        8. What’s Going On
        9. Further Study
      6. Vibrating
    11. 7. Network Programming with CFNetwork
      1. Basic Sockets Programming
        1. Socket Types
        2. CFSocket
          1. Creating new sockets
          2. Creating sockets from existing sockets
          3. Socket functions
          4. Enabling/disabling callbacks
          5. Sending data
          6. Callbacks
        3. CFSocketContext
        4. Socket Streams
          1. Read streams
          2. Write streams
        5. CFSocket Example: Joke Server
        6. Further Study
      2. CFHTTP and CFFTP
        1. CFHTTP
        2. CFFTP
        3. Further Study
    12. 8. Getting a Fix: Core Location
      1. The Core Location Manager
        1. Query Parameters
        2. Issuing a Query
        3. Receiving Updates
        4. Completing a Query
        5. Error Handling
        6. WhereYouAt: Redneck Core Location
        7. What’s Going On
        8. Further Study
    13. 9. Address Book Frameworks
      1. Address Book Access
        1. Top-Level Address Book Functions
        2. Querying the Address Book
        3. Creating Records
        4. Working with Records
          1. Writing properties
        5. Multivalue Properties
          1. Writing multivalue entries
        6. Working with Dictionaries
        7. Image Data
        8. Further Study
      2. Address Book UI
        1. Person Views
        2. People Pickers
          1. Delegate methods
        3. Further Study
    14. 10. Advanced UI Kit Design
      1. Common Controls
        1. The UIControl Base Class
          1. Properties
          2. Event notifications
        2. Segmented Controls
          1. Creating the control
          2. Adding segments
          3. Segment titles
          4. Images
          5. Momentary clicks
          6. Initializing default segment
          7. Displaying the control
          8. Reading the control
        3. Switches
          1. Creating the control
          2. Alternate colors
          3. Displaying the control
          4. Switch position
        4. Sliders
          1. Creating the control
          2. Displaying the control
          3. Reading the control
        5. Text Field Controls
          1. Style options
          2. Rendering overrides
          3. Delegate methods
          4. Notifications
          5. Scrolling text fields
        6. Buttons
          1. Creating the control
          2. Displaying the control
          3. Rendering overrides
        7. Page Controls
          1. Creating the control
          2. Displaying the control
          3. Notifications
        8. Further Study
      2. Preferences Tables
        1. Creating a Preferences Table
          1. Subclassing the table view controller
          2. Initializing the table
          3. Preferences table cells
          4. Controls
          5. Text fields
        2. Displaying the Preferences Table
        3. ShootStuffUp: Preferences Table Example
        4. What’s Going On
        5. Further Study
      3. Section Lists
        1. Creating the Section List
        2. Adding an Index Bar
        3. Displaying the Section List
        4. TableDemo: A Better File Browser
        5. What’s Going On
        6. Further Study
      4. Progress and Activity Indicators
        1. UIActivityIndicatorView: Things That Spin
        2. UIProgressView: When Spinny Things Are Tacky
        3. Network Activity Indicators
        4. Further Study
      5. Images
        1. The Image Object
          1. Working with files (static methods)
          2. Working with URLs and raw data (static methods)
          3. Working with Core Graphics (static methods)
          4. Working with files (instance methods)
          5. Working with URLs and raw data (instance methods)
          6. Working with Core Graphics (instance methods)
          7. Displaying an image
          8. Drawing patterns
          9. Orientation
          10. Image size
        2. ImageFun: Fun with Images and Patterns
        3. UIImageView: An Image with a View
        4. Image Pickers
          1. Image sources
          2. Image editing
          3. Image selection
      6. Keyboard Properties
        1. Keyboard Style
        2. Keyboard Appearance
        3. Return Key
        4. Autocapitalization
        5. Autocorrection
        6. Secure Text Entry
      7. Pickers
        1. Creating a Picker
          1. Picking picker properties
          2. Picker data source
        2. Displaying the Picker
        3. Reading the Picker
        4. NosePicker: Picking Your Nose
        5. What’s Going On
        6. Further Study
      8. Date/Time Pickers
        1. Creating the Date/Time Picker
          1. Date picker mode
          2. Time intervals
          3. Date ranges
        2. Displaying the Date Picker
        3. Reading the Date
        4. DatePicker: Independence Day Picker
        5. What’s Going On
        6. Further Study
      9. Tab Bars
        1. Tab Bar Controllers
        2. Building a Tab Bar Controller
          1. Build a collection
          2. Configure button properties
          3. Creating the tab bar controller
          4. Displaying the tab bar controller
        3. Customizable Buttons
        4. Navigation
        5. Delegate Actions
        6. TabDemo: Another Textbook Approach
        7. What’s Going On
        8. Further Study
      10. Sensors and Device Information
        1. Reading the Orientation
        2. Reading Device Information
        3. Reading the Accelerometer
          1. Tracking movement
        4. Proximity Sensor
        5. Further Study
      11. Scroll Views
        1. Creating the Scroll View
        2. Properties
        3. Delegate Methods
        4. BigImage: Scrolling a Weather Map
        5. What’s Going On
        6. Further Study
      12. Web Views
        1. Creating the Web View
        2. Displaying the Web View
        3. Loading Content
        4. Navigation
        5. Delegate Methods
        6. WebDemo: Google Search Utility
        7. What’s Going On
        8. Further Study
    15. 11. Application Settings
      1. Dictionaries and Property Lists
        1. Creating a Dictionary
        2. Managing Keys
        3. Writing Property Lists
        4. Reading Property Lists
        5. Further Study
      2. Preference Bundles
        1. Adding Keys
          1. Group separators
          2. Text fields
          3. Toggle switches
          4. Sliders
          5. Multivalue fields
          6. Child panes
        2. Reading Preference Bundle Values
        3. Further Study
    16. 12. Cover Flow
      1. CovertFlow: SDK Cover Flow Programming
        1. What’s Going On?
        2. Further Study
    17. 13. Page Flicking
      1. PageControl: Page Flicking Example
        1. What’s Going On?
        2. Further Study
      2. A PageScrollView for Many Views
        1. What’s Going On?
    18. 14. Media Player Framework
      1. Movie Player Controllers
        1. Properties
          1. Controls
          2. Aspect ratio
          3. Background color
        2. Starting and Stopping the Movie
        3. Notifications
        4. Further Study
    19. Index
    20. About the Author
    21. Colophon
    22. SPECIAL OFFER: Upgrade this ebook with O’Reilly