Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad Gesture Recognizer - Delayed Response

In my app I have added the new Gesture Recognizers that are available in the 3.2 SDK. Everything appears to be working correctly and the response time on the screen been very fast. But for some reason when I add requireGestureRecognizerToFail to some of my gestures, there is a very visible delay when the gesture is triggered. Below is a snippet of the code that I use to create the Gesture Recognizers. Does anyone know why there is a delay and how I can fix it? I'm using requireGestureRecognizerToFail to prevent the SingleTap gesture from triggering when the user performs a DoubleTap.

 - (void)createGestureRecognizers {

 //Single Finger Double-Tap
 UITapGestureRecognizer *singleFingerDTap = [[UITapGestureRecognizer alloc]
            initWithTarget:self action:@selector(handleSingleDoubleTap:)];
    singleFingerDTap.numberOfTapsRequired = 2;
    [super addGestureRecognizer:singleFingerDTap];

 //Single Finger Tap
 UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc]
              initWithTarget:self action:@selector(handleSingleTap:)];
    singleFingerTap.numberOfTapsRequired = 1;
 [singleFingerTap  requireGestureRecognizerToFail:singleFingerDTap];
 [self addGestureRecognizer:singleFingerTap];

 //Two Finger Pan
 UIPanGestureRecognizer *panGesture2 = [[UIPanGestureRecognizer alloc]
            initWithTarget:self action:@selector(handlePanGesture2:)];
    panGesture2.maximumNumberOfTouches = 2;
 [super addGestureRecognizer:panGesture2];

 //Single Finger Pan
 UIPanGestureRecognizer *panGesture1 = [[UIPanGestureRecognizer alloc]
             initWithTarget:self action:@selector(handlePanGesture1:)];
    panGesture1.maximumNumberOfTouches = 1;
 [panGesture1 requireGestureRecognizerToFail:panGesture2];
 [super addGestureRecognizer:panGesture1];

 [singleFingerDTap release];
 [singleFingerTap release];
    [panGesture1 release];
 [panGesture2 release];
}
like image 945
Maddoxx Avatar asked Jun 20 '10 22:06

Maddoxx


People also ask

Why does my iPad sometimes not respond to touch?

Dust and debris can not only make your iPad hard to see, they can cause it to stop responding to your touch. After turning off your device, use a microfiber cloth to wipe down the screen.

Is there a way to adjust touch sensitivity on iPad?

Go to Settings > Accessibility > Touch > Haptic Touch. Choose the touch duration—Fast or Slow. Test your new settings on the image at the bottom of the screen.

Why is my iPad touch screen slow?

First solution: Restart the iPad. The iPad may be just acting a little shaky due to some random glitches. Like iPhones, bad apps and corrupt caches can trigger random touch screen symptoms to occur suddenly. Most of the emerging symptoms are considered minor though, hence easily remedied by a restart.

What is tracking sensitivity in iPad?

This is the feature that controls how long it takes to reveal menus, previews, and other features when you tap-and-hold an item on the screen. If you have an iPhone with 3D Touch, this option is called 3D & Haptic Touch.


1 Answers

If you want to distinguish between a single and double tap, you must wait long enough to figure out that no second tap is coming before you can call it a single tap. The alternative would be to design all your single tap actions in such a way that they can asynchronously be canceled or reverted when a double tap is detected.

For example, if you have a single tap change pages and a double tap zoom, then you would have to animate a page changing on single tap, then reverse the animation and zoom instead when a second tap is detected. By then the view that handled the single tap may have moved. In most cases, that is more trouble and confusion then it is worth.

like image 120
drawnonward Avatar answered Oct 06 '22 22:10

drawnonward