0

The following does not work — handleSwipeUpTriple is never called:

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  
    UISwipeGestureRecognizer *swipeUpTripleRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeUpTriple:)];
    swipeUpTripleRecognizer.direction = UISwipeGestureRecognizerDirectionUp;
    swipeUpTripleRecognizer.numberOfTouchesRequired = 3; // triple finger
    // window is in nib
    [self.window addGestureRecognizer:swipeUpTripleRecognizer];
    [swipeUpTripleRecognizer release];
}

- (void) handleSwipeUpTriple:(UISwipeGestureRecognizer *)sender {
    printf("\nhandleSwipUpTrpl called."); // never happens
    if (sender.state == UIGestureRecognizerStateEnded) 
        printf("\n SwipeUpTriple recognized.");
}

}

The weird thing is that if I change the numberOfTouchesRequired to 1 or even 2, it works. Only 3 (or 4) fingers seem to be out of bounds. Since I see a number of posts regarding 3-finger gestures, I don’t see why this should be.

self.window.multipleTouchEnabled is YES.

For testing purposes, I have removed all subviews. There’s nothing but self.window on the screen.

I’m still using iOS 4.3, but since UISwipeGestureRecognizer was available by iOS 3.2, I don’t see why that should be a problem.

Wienke
  • 3,723
  • 27
  • 40
  • What device is this being run on? – Dustin Jun 28 '12 at 16:28
  • 1
    I know that the non-iPad devices sometimes are running system gesture recognizers for 3 fingers (usually zoom). Depending on your settings the system may have reserved this number of fingers for itself. – Dustin Jun 28 '12 at 16:31
  • Ohh, you're right! Under General > Accessibility "To zoom" is set to "double-tap with three fingers" and "To move around the screen" is set to "drag three fingers while zoomed." Thank heavens those *were* the settings. Otherwise I would never have suspected there was a problem until it failed for a user. So to be safe, I'll make my app-wide gestures 2-fingered rather than 3-fingered, so scrolling will have to be 1-fingered. Please repost you last comment as an answer and I'll mark it as accepted. – Wienke Jun 28 '12 at 16:38
  • Hah, only knew this because I gave an app to someone who had really bad vision and had the feature enabled. – Dustin Jun 28 '12 at 16:43
  • 1
    Just so you know, I think that you can query the accessibility settings from your code to detect which services are enabled. – Dustin Jun 28 '12 at 16:46
  • In my case, I was running "CityMaps2Go," which has microscopic unzoomable street names. Once they put something in the system, we'd better count on somebody using it... – Wienke Jun 28 '12 at 16:47

1 Answers1

1

I know that the non-iPad devices sometimes are running system gesture recognizers for 3 fingers (usually zoom). Depending on your settings the system may have reserved this number of fingers for itself.

As we found, you can fix this by going to General > Accessibility and disabling the three-finger gestures.

Dustin
  • 6,783
  • 4
  • 36
  • 53