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
?