0

I am using a UITapGestureRecognizer on an SKView to detect taps on the Siri remote (tvOS).

UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(recognized:)];
tapRecognizer.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypeUpArrow]];
[self.view addGestureRecognizer:tapRecognizer];

The taps never get recognized, the selector is never called. However when I use a UISwipeGestureRecognizer, everything works fine. I change nothing else.

UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(recognized:)];
swipeRecognizer.direction = UISwipeGestureRecognizerDirectionUp;
swipeRecognizer.delegate = self;
[self.view addGestureRecognizer:swipeRecognizer];

So, swipes DO work, taps DON'T work on an SKView. To fix it, I need to add the UITapGestureRecognizer to the parent UIView of the SKView.

Any ideas as to why the taps won't work on an SKView?

hotdogsoup.nl
  • 1,078
  • 1
  • 9
  • 22
  • 1
    GestureRecognizers has the States. If your view has the multiple gestureRecognizers, there is a chance of going a gesture to an invalid state..Selector won't be if the state is in invalid. – Apparao Mulpuri Oct 25 '19 at 11:15
  • @ApparaoMulpuri sorry I was editing the question for a long time. The view has no other gesture recognizers. – hotdogsoup.nl Oct 25 '19 at 11:32

0 Answers0