How do I know on which of the the child views an event occurred when using UIGestureRecognizers?
According to the documentation:
A gesture rec
For future users... I have got a better option now when world is not using obj-c anymore...
[sender view]
use it this way:
UITapGestureRecognizer * objTapGesture = [self createTapGestureOnView:myTextField];
[objTapGesture addTarget:self action:@selector(displayPickerView:)];
// add these methods
-(void)displayPickerView:(UITapGestureRecognizer*)sender
{
UITextField *textField = (UITextField*)[sender view];
NSLog(@"tag= %ld", (long)textField.tag);
}
-(UITapGestureRecognizer*)createTapGestureOnView:(UIView *)view
{
view.userInteractionEnabled = YES;
UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc]init];
tapGesture.numberOfTapsRequired = 1;
tapGesture.numberOfTouchesRequired = 1;
[view addGestureRecognizer:tapGesture];
return tapGesture;
}