La vista de tabla didSelectRowAtIndexPath, solo funciona después de seleccionar el segundo clic
Tengo una vista de tabla que configuré para que cuando el usuario toque la fila, se mueva a una nueva vista basada en el nombre de la celda en particular. Sin embargo, cuando hago clic en una celda por primera vez, no hace nada, y cuando hago clic en la celda siguiente, actuará como si hubiera hecho clic en la primera celda.
Por ejemplo, tengo casco, bastón y guantes. Si presiono Helmet, no pasa nada. Luego, si presiono Stick, se hará didSelectRowAtIndexPath para el Casco y no para el Stick. ¿Alguna sugerencia de por qué sucede esto?
//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];
}
}