我正在使用UITapGestureRecognizer
on anSKView
来检测 Siri 遥控器 (tvOS) 上的点击。
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(recognized:)];
tapRecognizer.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypeUpArrow]];
[self.view addGestureRecognizer:tapRecognizer];
水龙头永远不会被识别,选择器永远不会被调用。但是,当我使用 a 时UISwipeGestureRecognizer
,一切正常。我什么都没改变。
UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(recognized:)];
swipeRecognizer.direction = UISwipeGestureRecognizerDirectionUp;
swipeRecognizer.delegate = self;
[self.view addGestureRecognizer:swipeRecognizer];
所以,滑动可以工作,点击不能在SKView
. 要修复它,我需要将其添加UITapGestureRecognizer
到 SKView 的父UIView
级。
关于为什么水龙头不起作用的任何想法SKView
?