I have the following code for testing purposes:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self customTouchHandler:touches];
}
- (v
Also have this problem.
Only solution i found at this moment based on observing touch phase:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Began %lu of %lu", [touches count], [event.allTouches count]);
for (UITouch *touch in touches) {
[touch addObserver:self forKeyPath:@"phase" options:0 context:nil];
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Ended %lu of %lu", [touches count], [event.allTouches count]);
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([object isKindOfClass:[UITouch class]]) {
UITouch *touch = object;
NSLog(@"Touch %lu phase: %ld", (unsigned long)[touch hash], [touch phase]);
if (touch.phase == UITouchPhaseEnded || touch.phase == UITouchPhaseCancelled) {
NSLog(@"Touch %lu ended", (unsigned long)[touch hash]);
[touch removeObserver:self forKeyPath:@"phase"];
}
}
}