iPhone Open Application Development, 2nd Edition

Book description

"Great for beginners -- even if you don't know object-oriented programming, you can learn from examples on the 'Net and be on your way very soon. You will be able to confidently build apps that rival the ones included by Apple itself."-- Josh Content, iPhone Developer

Developers everywhere are eager to create applications for the iPhone, and many of them prefer the open source, community-developed tool chain to Apple's own toolkit. In this new edition of iPhone Open Application Development, author Jonathan Zdziarski covers the latest version of the open toolkit -- now updated for Apple's iPhone 2.x software and iPhone 3G -- and explains in clear language how to create applications using Objective-C and the iPhone API.

Zdziarski, who cracked the iPhone code and built the first fully-functional application with the open toolkit, includes detailed recipes and complete examples for graphics and audio programming, games programming with the CoreSurfaces and CoreImage interfaces, working with iTunes, and using sensors. With the open toolkit and this book, you can build iPhone applications that:

  • Display status bars, preference tables, and other standard elements of the iPhone user interface
  • Play pre-recorded files or program-generated sounds
  • Read and write plain text files and HTML files, including pages from the Web, and control display elements, such as scrollbars
  • Read and respond to changes in orientation when the user turns the phone around

And more. The first edition of this book developed an instant following and became the center of a movement. The second edition of iPhone Open Application Development will make this open source toolkit an indispensable part of iPhone application development.

Publisher resources

View/Submit Errata

Table of contents

  1. A Note Regarding Supplemental Files
  2. Preface
    1. Audience for This Book
    2. Organization of the Material
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Books Online
    6. Legal Disclaimer
    7. We’d Like to Hear from You
    8. Acknowledgments
  3. 1. Breaking Into and Setting Up the iPhone
    1. Jailbreak Procedures
      1. Third-Party Jailbreak Software
      2. Installing SSH
    2. Installing Additional Unix Components
    3. Additional Resources
  4. 2. Getting Started with Applications
    1. Anatomy of an Application
      1. Creating an Application Skeleton
    2. Building the Free Tool Chain
      1. What You’ll Need
        1. Supported desktop platform
        2. High-speed Internet connection
        3. Open source tools
        4. iPhone filesystem
      2. Compiling the Tool Chain
        1. Step 1: Install the Csu
        2. Step 2: Build and install cross-compiler tools
        3. Step 3: Install the system headers
        4. Step 4: Build and install LLVM
    3. Building and Installing Applications
      1. Installing an Application
    4. Transitioning to Objective-C
      1. Messaging
      2. Class and Method Declarations
        1. Imports
        2. Interface declaration
        3. Methods
      3. Implementation
      4. Categories
      5. Posing
      6. Further Study
  5. 3. Introduction to UIKit
    1. Basic User Interface Elements
    2. Windows and Views
      1. Creating a Window and View
      2. Displaying the View
    3. The Most Useless Application Ever
      1. What’s Going On
    4. Deriving from UIView
    5. The Second Most Useless Application Ever
      1. What’s Going On
      2. Further Study
    6. Text Views
      1. Creating a Text View
        1. Editing
        2. Margins
      2. Assigning Content
      3. Displaying the Text View
      4. Example: Displaying iPhone Disclaimers
      5. What’s Going On
      6. Further Study
    7. Navigation Bars
      1. Creating a Navigation Bar
        1. Setting the title
        2. Buttons and button styles
        3. Navigation bar style
      2. Displaying the Navigation Bar
      3. Intercepting Button Presses
      4. Disabling Buttons
      5. Adding a Segmented Control
      6. Example: Mute Button for the Spouse
      7. What’s Going On
      8. Further Study
    8. Transition Views
      1. Creating a Transition
      2. Calling a Transition
      3. Example: Page Flipping
      4. What’s Going On
      5. Further Study
    9. Action Sheets
      1. Creating an Action Sheet
      2. Action Sheet Buttons
        1. Destructive buttons
      3. Displaying the Action Sheet
      4. Intercepting Button Presses
      5. Dismissing an Action Sheet
      6. Example: End-of-the-World Button
      7. What’s Going On
      8. Further Study
    10. Tables
      1. Creating the Table
        1. Subclassing UITable
        2. Overriding UITable methods
        3. Data binding
        4. Labels
        5. Disclosures
        6. Image and text cells
        7. Swipe-to-delete
        8. Item selection
      2. Example: File Browser
      3. What’s Going On
      4. Further Study
    11. Status Bar Manipulation
      1. Status Bar Mode
        1. Mode
        2. Orientation
        3. Duration
        4. Fence ID
        5. Animation
      2. Hiding the Status Bar
      3. Status Bar Images
        1. Installation
        2. Displaying and removing the status bar image
    12. Application Badges
      1. Displaying an Application Badge
      2. Removing an Application Badge
      3. Further Study
    13. Application Services
      1. Suspending
      2. Resuming
      3. Program Termination
      4. Further Study
  6. 4. Event Handling and Graphics Services
    1. Introduction to Geometric Structures
      1. CGPoint
      2. CGSize
      3. CGRect
        1. Containment and intersection
        2. Edge and center detection
    2. Introduction to GSEvent
      1. Graphics Services
        1. Event location
        2. Event type
        3. Event chording (multiple-finger events)
      2. Mouse Events
        1. mouseDown
        2. mouseUp
        3. mouseDragged
        4. mouseEntered, mouseExited, mouseMoved
      3. Gesture Events
        1. gestureStarted
        2. gestureEnded
        3. gestureChanged
      4. Status Bar Events
    3. Example: The Icon Shuffle
      1. What’s Going On
      2. Further Study
  7. 5. Advanced Graphics Programming with Core Surface and Quartz Core
    1. Understanding Layers
    2. Screen Surfaces
      1. Creating a Screen Surface
      2. Displaying the Screen Surface
      3. Writing to the Screen Surface
      4. 16-Bit Pixel Formats
      5. Frame Buffer
      6. Example: Random Snow
      7. What’s Going On
    3. Layer Animation
      1. Creating a Layer Transition
        1. Available animations
        2. Available subtypes
        3. Animation speed and timing
        4. Transition flags
      2. Displaying the Layer Transition
      3. Example: Page Flipping with Style
      4. What’s Going On
      5. Further Study
    4. Layer Transformations
      1. Example: Spinning Wallpaper Demo
      2. What’s Going On
      3. Further Study
  8. 6. Making Some Noise
    1. Core Audio: It’s Great, but You Can’t Use It
    2. Celestial
      1. ringerState
      2. The Audio Controller
        1. Volume
        2. Repeat mode
        3. Sample rate
        4. Equalizer preset
        5. Mute
      3. Audio Samples
        1. Playing URLs
        2. Sample volume
        3. Equalizer preset
        4. Duration
      4. Audio Queues
      5. Example: Alternating Ringtones
      6. What’s Going On
      7. Further Study
    3. Audio Toolbox
      1. The “Other” Audio Queue: For Application-Generated Sound
        1. Audio queue structure
        2. Provisioning audio output
        3. Sound buffers
        4. Callback function
      2. Example: PCM Player
      3. What’s Going On
      4. Further Study
      5. Recording Sound
        1. Audio queue structure
        2. Provisioning audio output
        3. Sound buffers
        4. Callback function
      6. Example: Sound Recorder
      7. What’s Going On
      8. Volume Control
        1. Reading the volume
        2. Volume change notifications
      9. Example: What’s My Volume?
      10. What’s Going On
      11. Further Study
  9. 7. Advanced UIKit Design
    1. Controls
      1. Segmented Control
        1. Creating the control
        2. Images
        3. Momentary clicks
        4. Displaying the control
        5. Reading the control
      2. Switch Control
        1. Creating the control
        2. Displaying the control
        3. Reading the control
      3. Slider Controls
        1. Creating the control
        2. Displaying the control
        3. Reading the control
      4. Further Study
    2. Preferences Tables
      1. Creating a Preferences Table
        1. Subclassing the preferences table
        2. Caching preference cells
        3. Initialization
        4. Preferences table cells
        5. Text cells
        6. Controls
      2. Displaying the Preferences Table
      3. Example: Shoot-’Em-Up Game Settings
      4. What’s Going On
      5. Further Study
    3. Progress Indicators
      1. UIProgressIndicators: Things That Spin
      2. Example: A Simple Spinny Thingy
      3. What’s Going On
    4. UIProgressBar: When Spinny Things Are Tacky
      1. Example: A Better Built Bar
      2. What’s Going On
    5. Progress HUDs: When It’s Important Enough to Block Stuff
      1. Example: Hello, HUD!
      2. What’s Going On
      3. Further Study
    6. Image Handling
      1. The Image Object
        1. Static methods
        2. Instance methods
        3. Displaying an image
        4. Drawing patterns
      2. Example: Fun with Icons
      3. UIImageView: A View with a View
      4. UIAutocorrectImageView: Sizing It Up (or Down)
      5. UIClippedImageView: Crop Circles—Er, Squares
      6. UICompositeImageView: Layered Transparencies
        1. Transparency
        2. Scaling and positioning
      7. Example: Cool Clipping Animation
      8. What’s Going On
      9. Further Study
    7. Section Lists
      1. Creating a Section List
        1. Initialization
        2. Accessing the table object
      2. Displaying the Section List
      3. Selection Events
      4. Example: File Selector
      5. What’s Going On?
      6. Further Study
    8. Pickers
      1. Creating a Picker
        1. Picking picker properties
        2. The picker table
      2. Displaying the Picker
      3. Reading the Picker
      4. Example: Picking Your Nose
      5. What’s Going On
      6. Further Study
    9. Date/Time Pickers
      1. Creating the Date/Time Picker
        1. DatePicker mode
        2. Highlight “Today”
        3. Time intervals
        4. Date ranges
      2. Displaying the Date Picker
      3. Reading the Date
      4. Example: Independence Day Picker
      5. What’s Going On
      6. Further Study
    10. Toolbars
    11. Creating a Toolbar
      1. Displaying the Toolbar
      2. Toolbar Badges
      3. Intercepting Button Presses
      4. Example: Another Textbook Approach
      5. What’s Going On
      6. Further Study
    12. Orientation Changes
      1. Reading the Orientation
      2. Rotating Objects
      3. Example: Turning the World on Its Side
      4. What’s Going On
      5. Reading the Accelerometer
      6. Further Study
    13. Web Document Views and Scrollers
      1. Creating the Web View
      2. How Scrollers Work
        1. Adjusting the scrollers
        2. Auto-smoothing on resize
      3. Using the SimpleWebView Class
      4. Example: Simple Web Browser
      5. What’s Going On
      6. Further Study
  10. A. Miscellaneous Hacks and Recipes
    1. Dumping the Screen
      1. Example: Command-Line Screen Capture Utility
      2. What’s Going On
    2. Dumping the UI Hierarchy
    3. Invoking Safari
    4. Initiating Phone Calls
    5. Vibrating
    6. Transparent Views
    7. Cover Flow-Style Album Flipping
      1. What’s Going On
  11. Index
  12. About the Author
  13. Colophon
  14. Copyright

Product information

  • Title: iPhone Open Application Development, 2nd Edition
  • Author(s): Jonathan Zdziarski
  • Release date: October 2008
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596155193