title: UITableView - IndexPath always returns 0 first & takes 2 clicks to pass correct data to view controller
body: <p>I have a <code>UITableView</code> that segues to a <code>ViewController</code>. My tableview contains a list of location names and when you select a location, it passes more detailed data to the view controller about the selected location. My issue is that my index path always returns 0 on the first click / load no matter which row I click. I have to click each row twice for it pass the right data. </p>
  
  <p><strong>Example:</strong> I click row2 > returns row1's (0) data. I then click row2 again > correctly returns row2's data > I then click row3 > returns row2's data > I have to click row3 again to get row3's data. <code>indexPathSelected</code> in the below code is always <code>0</code> on load. </p>
  
  <pre><code>NSInteger indexPathSelected;
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
      indexPathSelected = indexPath.row;
  }
  
  #pragma mark - Navigation
  
  - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
      if ([[segue identifier] isEqualToString:@"showLocationDetails"])
  
      {
          LocationDetailsViewController *vc = [segue destinationViewController];
          vc.location = _locationsArray [indexPathSelected];
  
      }
  }
  </code></pre>