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

Book Description

Certain technologies bring out everyone's hidden geek, and iPhonedid the moment it was released. Even though Apple created iPhone asa closed device, tens of thousands of developers bought them withthe express purpose of designing and running third-partysoftware.In this clear and concise book, veteran hacker Jonathan Zdziarski-- one of the original hackers of the iPhone -- explains theiPhone's native environment and how you can build software for thisdevice using its Objective-C, C, and C++ developmentframeworks.iPhone Open Application Development walks you through theiPhone's native development environment, offers an overview of theObjective-C language you'll use with it, and supplies backgroundfor the iPhone operating system. You also get detailed recipes andworking examples for everyone's favorite iPhone features --graphics and audio programming, interfaces for adding multitouchfunctionality to games, the use of hardware sensors, and thedevice's vast user interface kit.This book explains:

  • How to access the iPhone's underlying operating system

  • The makeup of an iPhone application

  • How to get the open source tool chain running on yourdesktop

  • The iPhone's core user interface framework, which is heavilytied to major application-level functions

  • Using the many touted iPhone features such as multitouch,hardware sensors, and gestures

  • Intercepting and handling event notifications for manyiPhone-related events

  • Raw video surfaces and 3D transformations that take you deeperinto advanced graphics on the iPhone

  • How to record and play simple sounds and intercept soundevents

  • Advanced digital audio output using Apple's new Audio Toolboxframework

  • Advanced user interface components such as section lists,keyboards, and image manipulation

  • The Appendix includes a compendium of miscellaneous codeexamples for cool application features, such as using the cameraand creating a CoverFlow®-like album browser.This book is a true hacker's book, designed for the millions ofusers who have run third party applications on their iPhone, butits concepts and code examples have shown to be remarkably similarto Apple's official SDK, making this book a valuable resource forboth camps. Any programmer can use this book to write applicationswith the same spectacular effects that made the device an immediatehit, and impress users just as much as the official iPhone softwaredoes. That programmer can easily be you.

    Table of Contents

    1. iPhone Open Application Development
      1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
      2. A Note Regarding Supplemental Files
      3. 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
      4. 1. Breaking Into and Setting Up the iPhone
        1. Jailbreak Procedures
          1. Third-Party Jailbreak Software
          2. Downgrading iPhone Software
            1. Preparing for downgrade
            2. Downgrading the software
          3. Installing SSH
        2. Installing BSD Subsystem
        3. Additional Resources
      5. 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: Build and install the LLVM framework
            2. Step 2: Build and install cross-compiler tools
            3. Step 3: Patch the system headers
            4. Step 4: Install the Csu
            5. Step 5: Build and install llvm-gcc
        3. Building and Installing Applications
          1. Installing an Application
        4. Integrating with XCode
        5. 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
      6. 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
            3. Text properties
          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. Alert Sheets
          1. Creating an Alert Sheet
          2. Alert Sheet Buttons
            1. Destructive buttons
          3. Displaying the Alert Sheet
          4. Intercepting Button Presses
          5. Dismissing an Alert 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. Status Bar Size
          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
      7. 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
      8. 5. Advanced Graphics Programming with Core Surface and Layer Kit
        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
      9. 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
            5. Playing an item
            6. Pausing
          4. Example: Hello, Sound!
          5. What's Going On
          6. Audio Queues
          7. Example: Alternating Ringtones
          8. What's Going On
          9. Recording Sound
          10. Example: Voice Recorder
          11. What's Going On
          12. 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. Volume Control
            1. Reading the volume
            2. Volume change notifications
          6. Example: What's My Volume?
          7. What's Going On
          8. Further Study
      10. 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. UIProgressIndicator: 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
            5. Orientation
          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. Keyboards
          1. Creating the Keyboard
          2. Keyboard Properties
            1. Keyboard style
            2. Return key
            3. Autocapitalization
            4. Autocorrection
            5. Secure text entry
            6. Single entry completion
          3. Displaying the Keyboard
            1. Focusing the text object
            2. Showing and hiding the keyboard
          4. Example: A Simple Text Editor
          5. What's Going On
          6. Further Study
        9. 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
        10. Date/Time Pickers
          1. Creating the Date/Time Picker
            1. DatePicker mode
            2. Highlight "Today"
            3. Time intervals
            4. Date ranges
            5. Sound
          2. Displaying the Date Picker
          3. Reading the Date
          4. Example: Independence Day Picker
          5. What's Going On
          6. Further Study
        11. Button Bars
        12. Creating a Button Bar
          1. Displaying the Button Bar
          2. Button Badges
          3. Intercepting Button Presses
          4. Example: Another Textbook Approach
          5. What's Going On
          6. Further Study
        13. 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
        14. Web 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
      11. 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
          1. Example: LaunchURL
          2. What's Going On
        4. Initiating Phone Calls
        5. Vibrating
        6. Transparent Views
        7. Taking Camera Photos
          1. Installing CameraController Prototypes
          2. Taking Pictures
          3. Example: Snap App
          4. What's Going On
        8. Cover Flow-Style Album Flipping
          1. What's Going On
      12. Colophon
      13. About the Author
      14. SPECIAL OFFER: Upgrade this ebook with O’Reilly