Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 3D Touch取消我的自定义手势_Ios_Objective C_Iphone - Fatal编程技术网

Ios 3D Touch取消我的自定义手势

Ios 3D Touch取消我的自定义手势,ios,objective-c,iphone,Ios,Objective C,Iphone,我有下面的手势识别器在触摸视图时进行检测。我使用它来突出显示标签中的超链接 @implementation TouchGestureRecognizer - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { self.state = UIGestureRecognizerStateBegan; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEv

我有下面的手势识别器在触摸视图时进行检测。我使用它来突出显示标签中的超链接


@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
当触摸是“深”触摸时,我有一个问题,比如在模拟器中,或者在iPhone6S上,如果你用iOS9.0SDK用力按下,我会遇到这个问题。“浅”按可以按预期效果,但“深”按会立即取消手势

发行说明中提到,touchesMoved:是针对强制触摸手势发送的,但是删除
状态=ui手势识别器状态failed
不会更改取消该手势


在iOS 9.0 SDK上运行iPhone 6S(sim/设备)时,我是否可以对上述代码进行任何更改?或者,使用iOS 9.1 SDK构建是解决此问题的唯一方法吗?

我发现,如果用UILongPressGestureRecognitor替换自定义手势识别器,则深按不会取消该识别器。有什么不同?