Skip to content

Instantly share code, notes, and snippets.

@psobko
Last active April 14, 2016 19:08
Show Gist options
  • Save psobko/7646347 to your computer and use it in GitHub Desktop.
Save psobko/7646347 to your computer and use it in GitHub Desktop.
self.gestureRecognizer = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleTap:)];
self.gestureRecognizer.numberOfTapsRequired = 1;
[self.view addGestureRecognizer:self.gestureRecognizer];
self.gestureRecognizer.cancelsTouchesInView = NO;
-(void)handleTap:(UITapGestureRecognizer *)recognizer
{
CGPoint translatedPoint = [recognizer locationInView:self.view];
UIView *viewTouched = [recognizer.view hitTest:translatedPoint withEvent:nil];
if(viewTouched != someView)
{
// some action
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment