Skip to Main Content
Professional iPhone™ and iPod® touch Programming: Building Applications for Mobile Safari™
book

Professional iPhone™ and iPod® touch Programming: Building Applications for Mobile Safari™

by Richard Wagner
January 2008
Beginner to intermediate content levelBeginner to intermediate
307 pages
6h 49m
English
Wrox
Content preview from Professional iPhone™ and iPod® touch Programming: Building Applications for Mobile Safari™

Chapter 5. Handling Touch Interactions and Events

An essential part of any Web 2.0 application is the ability to respond to events triggered by the user or by a condition that occurs on the client. The clicking of a button. The pressing of a key. The scrolling of a window. While the user interacts with an HTML element, the entire document, or the browser window, JavaScript serves as the watchful eye behind the scenes that monitors all of this activity taking place and fires off events as they occur.

With its touch screen interface, iPhone is all about direct interactivity with the user. As a result, you would expect any iPhone/iPod touch application you create to be able to handle the variety of finger taps, flicks, swipes, and pinches that a user naturally performs as they interact with their mobile device. However, because of the current capabilities of Mobile Safari browser, you have to work with these interactions differently than what you might expect.

How iPhone Handles Events

When working with touch interactions and events for iPhone, keep in mind that the finger is not a mouse. As a result, the traditional event model that Web developers are so used to working with does not always apply in this new context. This is both good news and bad news for the application developer. The good news is that much of the touch interaction that iPhone and iPod touch are famous for is built right into Mobile Safari. As a result, you do not need to write any code to handle the basic touch interactions ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The iPhone™ Developer’s Cookbook: Building Applications with the iPhone 3.0 SDK, Second Edition

The iPhone™ Developer’s Cookbook: Building Applications with the iPhone 3.0 SDK, Second Edition

Erica Sadun
Release 2.0: Issue 3

Release 2.0: Issue 3

Jimmy Guterman

Publisher Resources

ISBN: 9780470251553Purchase book