title: How to get the index of a tapped object in a TableView?
body: <p>I got a tableView with custom cells. Inside each of these cells, there's a UILabel, which get it's text from an NSMutableArray. I set up a GestureRecognizer to see if this label is tapped or not. And if it's tapped, I go to another view. </p>
  
  <p>Now in the method associated to the selector for the labels, I would like to get the index of the text in the NSMutableArray, corresponding to the tapped label. How could I do that?</p>
  
  <p>Here is some sale code :
  In the cellForRowAtIndexPath: method, here's what I do :</p>
  
  <pre><code>    cell.Label.text = [tableLabelText objectAtIndex:indexPath.row];
  
      UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goToViewControllerB:)];
  
      [cell.Label setUserInteractionEnabled:YES];
      [cell.Label addGestureRecognizer:tap];
      [tap release];
  </code></pre>
  
  <p>then I display everything...</p>
  
  <p>and here's the goToViewControllerB method :</p>
  
  <pre><code>- (void) goToViewControllerB:(id)sender {
      if (!viewControllerB) {
      viewControllerB = [[ViewControllerB alloc] initWithNibName:@"ViewControllerB" bundle:nil];
  }
      navigationController = [[UINavigationController alloc] initWithRootViewController:viewControllerB];
      [self presentModalViewController:navigationController animated:YES];
  }
  </code></pre>
  
  <p>If I do that, and if in my viewControllerB I modify something and go back to the Table View, then click on another label, I will be lead to the same viewControllerB, containing the previous modification. I do want to show a new viewControllerB for each label.</p>
  
  <p>My idea was to get the index of tableLabelText corresponding to the tapped Label. The I could, whenever I call the goToViewControllerB:, create a new object of type ViewControllerB and insert it into a NSMUtableArray, at the same index...Something like </p>
  
  <pre><code>if ([ViewControllerArray objectAtIndex: "here the index i'm looking for"]){
  "show it" }
  else {
  "create it and insert it into ViewControllerArray at the right index" }
  </code></pre>