Skip to content

Instantly share code, notes, and snippets.

@Andrewmika
Last active March 8, 2019 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrewmika/54d937cfc13e2cd196fde73942e9837c to your computer and use it in GitHub Desktop.
Save Andrewmika/54d937cfc13e2cd196fde73942e9837c to your computer and use it in GitHub Desktop.
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if (self.clipsToBounds || self.hidden || (self.alpha == 0.f)) {
return nil;
}
UIView *view = [super hitTest:point withEvent:event];
if (view) {
return view;
}
for (UIView *subView in self.subviews.reverseObjectEnumerator) {
CGPoint subPoint = [subView convertPoint:point fromView:self];
view = [subView hitTest:subPoint withEvent:event];
if (view) {
return view;
}
}
return nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment