UITapGestureRecognizer selector, sender is the gesture, not the ui object

Solution 1:

I figured out how to get the tag, which was the most important part of the question for me. Since the gesture is the sender, I figured out the the view it is attached to is sent along with it:

[(UIGestureRecognizer *)sender view].tag

I am still curious if anyone can tell me how to send an argument through a UITapGestureRecognizer selector.

Solution 2:

The only argument you can send through UITapGestureRecognizer selector is the UITapGestureRecognizer itself as following:

Make sure to put ":" after the selector name like you previously did :

UITapGestureRecognizer *singleTap = 
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectImage:)];

Then add a parameter to selectImage so you can retrieve the View as following:

-(void) selectImage:(UITapGestureRecognizer *)gestureRecognizer{

    //Get the View
    UIImageView *tableGridImage = (UIImageView*)gestureRecognizer.view;
}