O'Reilly logo

iPhone JavaScript Cookbook by Arturo Fernandez Montoro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Detecting one-finger events

Users interact with the iPhone through a touch screen. No physical keyboard or mouse is available. The fingers serve as both the pointer and the input device. When the user touches the screen, a single event is launched. Safari Mobile defines different types of events, which capture and respond to the movements and touches of the user. We can respond to a one-finger or multi-touch finger event because the iPhone is a multi-touch device. In this recipe, we find out how to detect when the user is using one finger to interact with the device.

Getting ready

We are going to use the iWebKit framework for building a simple user interface to detect the events.

How to do it...

  1. Create a standard XHTML file with the following lines ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required