Open lucferbux opened 8 years ago
When overriding the touchesBegan method in a category the scroll stop working. There is no easy way to detect a touch in the view.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UIView * hitTestView = [self getNextResponderView:touches withEvent:event]; [hitTestView touchesBegan:touches withEvent:event]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UIView * hitTestView = [self getNextResponderView:touches withEvent:event]; [hitTestView touchesMoved:touches withEvent:event]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UIView * hitTestView = [self getNextResponderView:touches withEvent:event]; [hitTestView touchesEnded:touches withEvent:event]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { UIView * hitTestView = [self getNextResponderView:touches withEvent:event]; [hitTestView touchesCancelled:touches withEvent:event]; } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { return self; } - (UIView *)getNextResponderView:(NSSet *)touches withEvent:(UIEvent *)event { UITouch * touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; UIView * hitTestView = [super hitTest:point withEvent:event]; return ( hitTestView == self ) ? nil : hitTestView; }
When overriding the touchesBegan method in a category the scroll stop working. There is no easy way to detect a touch in the view.