O'Reilly logo

Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming by Erica Sadun, Rod Strougo, Maurice Sharp

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

Creating the Return Gesture Recognizer

Before you create the gesture recognizer, you need to choose a gesture and determine how to detect it. Since it returns the iPad app to a known state, you can use a small letter r. The first challenge is determining how to recognize the character.

The easiest way to recognize a stroke is by breaking it down into components separated by transitions in x and/or y movement. As part of the events, you get both the current and previous touch points, allowing detection of changes in movement. The x value increases from left to right of the screen, and y increases from top to bottom. You can use comparisons between previous and current positions to determine changes in direction. If you needed other information ...

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