wethu
1/3/2015 - 6:53 AM

example.m

- (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 
}