From a2068a5982c71b467d5abeabed613e94e7285833 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 29 Aug 2017 17:48:28 +0800 Subject: [PATCH] fix navigationBar touch event related issue --- STPopup/STPopupNavigationBar.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/STPopup/STPopupNavigationBar.m b/STPopup/STPopupNavigationBar.m index a2fb77c..02d0096 100644 --- a/STPopup/STPopupNavigationBar.m +++ b/STPopup/STPopupNavigationBar.m @@ -101,4 +101,22 @@ - (void)movingDidEndWithOffset:(float)offset } } +- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{ + if (!self.isUserInteractionEnabled || self.isHidden || self.alpha <= 0.01) { + return nil; + } + + if ([self pointInside:point withEvent:event]) { + for (UIView *subview in [self.subviews reverseObjectEnumerator]) { + CGPoint convertedPoint = [subview convertPoint:point fromView:self]; + UIView *hitTestView = [subview hitTest:convertedPoint withEvent:event]; + if (hitTestView) { + return hitTestView; + } + } + return self; + } + return nil; +} + @end