Skip to content

Instantly share code, notes, and snippets.

@xissburg
Created February 1, 2015 15:10
Show Gist options
  • Save xissburg/a655b0aeb5497b1698af to your computer and use it in GitHub Desktop.
Save xissburg/a655b0aeb5497b1698af to your computer and use it in GitHub Desktop.
#import "UntouchableView.h"
@implementation UntouchableView
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
if (!CGRectContainsPoint(self.bounds, point)) {
return NO;
}
for (UIView *subview in self.subviews) {
if (subview.isUserInteractionEnabled && [subview pointInside:[self convertPoint:point toView:subview] withEvent:event]) {
return YES;
}
}
if (self.didTouch) {
self.didTouch(point, event);
}
return NO;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment