You are previewing iPhone JavaScript Cookbook.
O'Reilly logo
iPhone JavaScript Cookbook

Book Description

Clear and practical recipes for building web applications using JavaScript and AJAX without having to learn Objective-C or Cocoa

  • Build web applications for iPhone with a native look feel using only JavaScript, CSS, and XHTML

  • Develop applications faster using frameworks

  • Integrate videos, sound, and images into your iPhone applications

  • Work with data using SQL and AJAX

  • Write code to integrate your own applications with famous websites such as Facebook, Twitter, and Flickr

  • These practical recipes include code and screenshots offering a clear step-by-step guide using different frameworks

In Detail

Undoubtedly, the iPhone is one of the most exciting mobile devices in the world. Its iOS is used in other Apple devices such as the iPad and iPod Touch. With this book you'll learn how to build and develop applications for these devices without applying Apple's burdensome and at times restrictive technologies. Just use your experience and knowledge combined with web front-end technologies like JavaScript to build quality web apps. Nobody will know you haven't used Objective-C and Cocoa.

The iPhone JavaScript Cookbook offers a set of practical and clear recipes with a step-by-step approach for building your own iPhone applications applying only web technologies such as JavaScript and AJAX. Web developers won't need to learn a new programming language for building iOS applications with a native look and feel.

The first part of the book introduces you to the world of iPhone applications. Understanding how it works is required for designing good user interfaces for this device. You will continue learning about how to apply multimedia features to your applications. Common features of web applications, such as AJAX and SQL, can also be applied to our iPhone applications. The third part of the book explains how to deal with specific features of iPhone such as the accelerometer. At the end, you learn how to offer additional features through external websites. With the iPhone JavaScript Cookbook, you will be able to develop outstanding web applications with a for Apple's mobile devices, offering your users all of the advantages of the native look and feel.

Table of Contents

  1. iPhone JavaScript Cookbook
    1. iPhone JavaScript Cookbook
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. www.PacktPub.com
          1. Support files, eBooks, discount offers and more
            1. Why subscribe?
            2. Free access for Packt account holders
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    7. 1. Frameworks Make Life Easier
      1. Introduction
      2. Installing the iUI framework
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Installing the UiUIKit framework
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Installing the XUI framework
        1. Getting ready
        2. How to do it...
        3. How it works...
      5. Installing the iWebKit framework
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Installing the WebApp.Net framework
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Installing the PhoneGap framework
        1. Getting ready
        2. How to do it...
        3. How it works...
      8. Installing the Sencha Touch framework
        1. Getting ready
        2. How to do it...
        3. How it works...
      9. Installing the Apple Dashcode framework
        1. Getting ready
        2. How to do it...
        3. How it works...
    8. 2. Building Interfaces
      1. Introduction
      2. Creating a toolbar
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Modifying the default status bar
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Creating a footer
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Creating a back button
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Creating a button for the toolbar
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      7. Building a breadcrumb menu
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      8. Building the duo navigation buttons
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more....
        5. See also
      9. Building the lists for items
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Building menus using lists
        1. Getting ready
        2. How to do it...
          1. Using UiUIKit
          2. Using iWebKit
        3. How it works...
        4. There's more....
        5. See also
      11. Creating the toggle buttons
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      12. Creating a modal box with buttons
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      13. Building a search dialog
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      14. Building the information fields
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      15. Building forms with checkboxes, radio buttons, select fields, and text fields
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      16. Creating and customizing a notification box
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more
        5. See also
      17. Building a chat-style interface
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      18. Creating a date picker
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      19. Using different tabs
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    9. 3. Events and Actions
      1. Introduction
      2. Identifying the devices
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Viewing applications in full screen
        1. How to do it...
        2. How it works...
        3. See also
      4. Detecting full screen or browser mode
        1. How to do it...
        2. How it works...
        3. See also
      5. Scaling to device width
        1. How to do it...
        2. How it works...
        3. See also
      6. Preventing scaling
        1. How to do it...
        2. How it works...
        3. See also
      7. Detecting one-finger events
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      8. Detecting multi-touch events
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Preventing the default behavior for events
        1. How to do it...
          1. How it works...
          2. See also
        2. Detecting rotation events
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Implementing drag-and-drop
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Adding visual effects
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Running your web application without Internet access
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
    10. 4. A Picture Speaks a Thousand Words
      1. Introduction
      2. Choosing an icon image for the application
        1. Getting ready
        2. How to do it...
          1. How it works...
          2. There's more...
          3. See also
      3. Specifying a splash image
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Displaying an image inside a container
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Creating a grid with images
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Creating a carousel for images
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Rotating images
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      8. Scaling an image by applying animations
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Taking and displaying pictures
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Drawing geometric figures
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Applying colors
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      12. Working with gradients
        1. Getting ready
        2. How to do it...
          1. Applying linear gradients
          2. Using radial gradients
        3. How it works...
        4. See also
      13. Adding an activity indicator
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    11. 5. Mastering Sound and Music
      1. Introduction
      2. Making a beep alert
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Making a vibrate alert
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Creating an iPod playlist and playing a specific item
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Loading an iTunes playlist
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Playing an audio file
        1. Getting ready
        2. How to do it...
          1. Using HTML5
          2. Using Sencha Touch
          3. Using PhoneGap
        3. How it works...
          1. HTML5 approach
          2. Sencha Touch approach
          3. PhoneGap approach
        4. There's more...
        5. See also
      7. Playing a video
        1. Getting ready
        2. How to do it...
          1. Using HTML5
          2. Using Sencha Touch
        3. How it works...
        4. There's more...
        5. See also
      8. Recording an audio
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    12. 6. Exchanging Data: AJAX
      1. Introduction
      2. How to send HTTP requests
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Processing JSON responses
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Sending cross-domain requests
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    13. 7. Working with Data: Storage and SQL
      1. Introduction
      2. Creating a database
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Creating a table
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Inserting records
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Searching and selecting records
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Deleting records
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      7. Saving and reading preferences
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      8. Storing data in session
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    14. 8. This is a Phone
      1. Introduction
      2. Calling a number
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      3. Sending an SMS to a number
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Selecting contacts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Creating a new contact
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Searching and displaying contacts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    15. 9. Location, Location, Location
      1. Introduction
      2. Detecting current orientation
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      3. Identifying the current location
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Opening Google Maps at a specific location
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Calculating distances between two points
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    16. 10. Web 2.0 Integration
      1. Introduction
      2. Embedding an RSS feed
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Opening a YouTube video
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Posting on your Facebook wall
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Retrieving recent tweets from Twitter
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Displaying photos from Flickr
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also