我正在触摸视图时检测以下手势识别器。我用它来突出标签中的超链接。
@implementation TouchGestureRecognizer
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
self.state = UIGestureRecognizerStateBegan;
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
self.state = UIGestureRecognizerStateFailed;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
self.state = UIGestureRecognizerStateEnded;
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
self.state = UIGestureRecognizerStateCancelled;
}
@end
当触摸是模拟器中的“深度”触摸时,或者如果你用iOS 9.0 SDK用力按下iPhone 6S,我就会遇到问题。 “浅”的印刷机按预期工作,但“深度”按下会立即取消手势。
发行说明中提到touchesMoved:是针对强制触摸手势发送的,但删除state = UIGestureRecognizerStateFailed
并不会更改该手势的取消。
在iOS 9.0 SDK上,有什么我可以改变以上代码在iPhone 6S(sim /设备)上工作吗?或者使用iOS 9.1 SDK构建解决此问题的唯一方法是什么?