title: iOS - UITapGestureRecognizer - Selector with Arguments
body: <p>In my app I am dynamically adding images to my view at runtime. I can have multiple images on screen at the same time. Each image is loaded from an object. I have added a tapGestureRecongnizer to the image so that the appropriate method is called when I tap it.</p>
  
  <pre><code>    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)];
      [plantImageView addGestureRecognizer:tapGesture];
  </code></pre>
  
  <p>My problem is that I don't know what image I have tapped. I know I can call tapGestureRecognizer.location to get the location on screen but thats not really much good to me. Ideally, I'd like to be able to pass the object that the image was loaded from into the tap gesture. However, it seems that I am only able to pass in the selector name "imageTapped:" and not its arguments.</p>
  
  <pre><code>- (IBAction)imageTapped:(Plant *)plant
  {
     [self performSegueWithIdentifier:@"viewPlantDetail" sender:plant];
  }
  </code></pre>
  
  <p>Does anyone know of a way that I can pass my object as an argument into the tapGestureRecongnizer or any other way I can get a handle on it?</p>
  
  <p>Thanks</p>
  
  <p>Brian</p>