Table view didSelectRowAtIndexPath, only works after selecting second click

I have a table view which I’ve configured so that when the user taps the row, it will move to a new view based on the name of the particular cell. However, when I first click a cell it does nothing, and when I click the next cell, it will act as if I had clicked the first cell.

For example, I have Helmet, Stick and Gloves. If I press Helmet, nothing happens. Then, if I press Stick, it will do the didSelectRowAtIndexPath for the Helmet and not the Stick. Any suggestion as to why this is happening?

  • iOS Drawing Circles
  • Point of using NSPersistentStoreCoordinator?
  • why added blank space between searchBar and tableview?
  • Does iOS Calendar support a URL scheme?
  • Dismiss modal form sheet view on outside tap iOS 8
  • Getting bad access while deleting cell and reloading table view
  • //Tapping to change on row
    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
        NSLog(@"%@", cell.textLabel.text);
        if([cell.textLabel.text isEqualToString:@"Helmet"])
        {
            [self performSegueWithIdentifier:@"toHelmetView" sender:indexPath];
        }
    }
    
    
    //Segue control, fetch helmet and send it
    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
        if ([segue.identifier isEqualToString:@"toHelmetView"])
        {
            // Fetch the selected object
            //EquipmentCategory *o = [_frc objectAtIndexPath:[self.tableView indexPathForSelectedRow]];
    
            // Configure the next view + controller
            HelmetView *nextVC = (HelmetView *)segue.destinationViewController;
    
            nextVC.title = @"Helmet";
            nextVC.model = self.model;
            nextVC.h = [self.model helmetForPlayer:self.p];
        }
    
    }
    

    Solutions Collect From Internet About “Table view didSelectRowAtIndexPath, only works after selecting second click”

    That is because you implemented didDeselectRowAtIndexPath instead of
    didSelectRowAtIndexPath.