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 multi-touch events

The previous recipe shows how to detect events for one-finger events, but one of the most celebrated features of the iPhone is the multi-touch screen. Using more than one finger, users can do different actions in a very intuitive and easy way. For instance, zoom over a picture is one of these actions. This action requires using only two fingers, but other more complicated actions can use more fingers. One example of this could be a game for playing a piano.

This recipe shows the difference between one-finger and multi-touch events and how we can detect it.

Getting ready

For simplicity, we're going to continue using the iWebKit framework. You can reuse the file created in the previous recipe.

How to do it...

  1. Open your XHTML ...

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