O'Reilly logo

Beginning iPhone® SDK Programming with Objective-C® by Wei-Meng Lee

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

Chapter 14. Programming Multi-Touch Applications

WHAT YOU WILL LEARN IN THIS CHAPTER

  • How to detect touches in your application

  • How to differentiate between single and double taps

  • How to implement the pinch gesture

  • How to implement the drag gesture

One of the most important selling points of the iPhone is its screen, which can detect multiple points of input. Multi-touch inputs allow for very natural interaction between users and your applications. Because of multi-touch, the mobile Safari Web browser is easily one of the most user-friendly Web browsers available on a smart phone.

In this chapter, you learn how to detect touches in your application and then implement some cool features that improve the interaction between the user and the application, such as a Jigsaw Puzzle application. By detecting touches in your application, the user can rearrange the locations of the images on the screen, as well as change the size of the images using the pinching gesture.

DETECTING TOUCHES

Before you learn how to detect touches in your application, you first need to acquaint yourself with a few events that handle the detection of touches. You will then be able to know whether the user has single-tapped or double-tapped on your application and react accordingly.

Time to get the engine rolling! Make sure you download the code indicated here so you can work through the following Try It Out activity.

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