Question

I would like to create a custom UIGestureRecognizer for a "tickle"... in other words, detecting a swipeLeft followed by a swipeRight, twice, without lifting the finger.

I know I can create it by starting from scratch with a custom gesture, but then I'll need to implement all the 'touches' methods and basically re-invent the swipe gestures. Is there any way of creating a custom UIGestureRecognizer just by combining ones that already exist? In other words, a custom UIGestureRecognizer that extends a UISwipeGestureRecognizer?

Or will I need to build it from scratch? If so, does anyone know the underlying code for a swipe gesture?

Was it helpful?

Solution

I know you hesitate to build it from scratch, but tbh, any other way would feel "hacked together".

Besides, building this particular gesture from scratch will be easy because Ray Wenderlich's gesture recognizer tutorial actual talks about implementing your own custom gesture... Now only that, but he shows you how to implement a tickle gesture!

Here's a link to his tutorial: http://www.raywenderlich.com/6567/uigesturerecognizer-tutorial-in-ios-5-pinches-pans-and-more

The part about the tickle gesture is towards the bottom. Feel free to follow his tutorial and learn how to use it, or you can probably just download his sample code and copy/paste his tickle gesture recognizer class.

Edit: Oops, this question is many months old. Oh well, it has an answer now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top