PacktLib: iPhone JavaScript Cookbook

iPhone JavaScript Cookbook


About the Author

About the Reviewers


Frameworks Make Life Easier


Installing the iUI framework

Installing the UiUIKit framework

Installing the XUI framework

Installing the iWebKit framework

Installing the WebApp.Net framework

Installing the PhoneGap framework

Installing the Sencha Touch framework

Installing the Apple Dashcode framework

Building Interfaces


Creating a toolbar

Modifying the default status bar

Creating a footer

Creating a back button

Creating a button for the toolbar

Building a breadcrumb menu

Building the duo navigation buttons

Building the lists for items

Building menus using lists

Creating the toggle buttons

Creating a modal box with buttons

Building a search dialog

Building the information fields

Building forms with checkboxes, radio buttons, select fields, and text fields

Creating and customizing a notification box

Building a chat-style interface

Creating a date picker

Using different tabs

Events and Actions


Identifying the devices

Viewing applications in full screen

Detecting full screen or browser mode

Scaling to device width

Preventing scaling

Detecting one-finger events

Detecting multi-touch events

Preventing the default behavior for events

A Picture Speaks a Thousand Words


Choosing an icon image for the application

Specifying a splash image

Displaying an image inside a container

Creating a grid with images

Creating a carousel for images

Rotating images

Scaling an image by applying animations

Taking and displaying pictures

Drawing geometric figures

Applying colors

Working with gradients

Adding an activity indicator

Mastering Sound and Music


Making a beep alert

Making a vibrate alert

Creating an iPod playlist and playing a specific item

Loading an iTunes playlist

Playing an audio file

Playing a video

Recording an audio

Exchanging Data: AJAX


How to send HTTP requests

Processing JSON responses

Sending cross-domain requests

Working with Data: Storage and SQL


Creating a database

Creating a table

Inserting records

Searching and selecting records

Deleting records

Saving and reading preferences

Storing data in session

This is a Phone


Calling a number

Sending an SMS to a number

Selecting contacts

Creating a new contact

Searching and displaying contacts

Location, Location, Location


Detecting current orientation

Identifying the current location

Opening Google Maps at a specific location

Calculating distances between two points

Web 2.0 Integration


Embedding an RSS feed

Opening a YouTube video

Posting on your Facebook wall

Retrieving recent tweets from Twitter

Displaying photos from Flickr