Skip to content

Instantly share code, notes, and snippets.

@wethu
Created January 3, 2015 06:53
Show Gist options
  • Select an option

  • Save wethu/06c3e6b228355b98f380 to your computer and use it in GitHub Desktop.

Select an option

Save wethu/06c3e6b228355b98f380 to your computer and use it in GitHub Desktop.
- (void) someSetupMethod {
UIView *view = [UIView new];
view.userInteractionEnabled = YES;
// Target is self, self is the controller that you're in right now and will call the method iGotTapped: on itself.
UIGestureRecognizer *tap = [[UIGestureRecognizer alloc] initWithTarget:self action:@selector(iGotTapped:)];
// addGesture to view
[view addGestureRecognizer:tap];
}
- (void)iGotTapped:(UIView *)sender {
NSLog(@"I'm UIView %@", sender);
// Do stuff with it
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment