这是我的 CustomUIGestureRecognizer.m
的代码@implementation CustomTapGestureRecognizer
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if(_customDelegate != nil && [_customDelegate respondsToSelector:@selector(onTouchDown:)])
{
[_customDelegate onTouchDown:self];
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if(_customDelegate != nil && [_customDelegate respondsToSelector:@selector(onTouchUp:)])
{
[_customDelegate onTouchUp:self];
}
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"cancelled");
}
@end
从上面的代码可以看出,我只能检测“触地”和“修饰”事件。但是,我需要检测“内部触摸”控制事件。
当我将手指抬到视线外时,我试图检查是否会触发取消的触摸,这样我就可以知道触摸是否在内部。不幸的是,它没有被召集。
有什么想法吗?谢谢!