tap gesture recognizer - which object was tapped?
Define your target selector(highlightLetter:
) with argument as
UITapGestureRecognizer *letterTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(highlightLetter:)];
Then you can get view by
- (void)highlightLetter:(UITapGestureRecognizer*)sender {
UIView *view = sender.view;
NSLog(@"%d", view.tag);//By tag, you can find out where you had tapped.
}
Its been a year asking this question but still for someone.
While declaring the UITapGestureRecognizer
on a particular view assign the tag as
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gestureHandlerMethod:)];
[yourGestureEnableView addGestureRecognizer:tapRecognizer];
yourGestureEnableView.tag=2;
and in your handler do like this
-(void)gestureHandlerMethod:(UITapGestureRecognizer*)sender {
if(sender.view.tag == 2) {
// do something here
}
}