I’ve got 6 diffident tables and when the row in one of them is selected (in the regionsFirstTable it matters which one) I want them to perform a segue. The code for regionsFirstTable works fine, but as for the other part it doesn’t – the segues are just not working. I know it’s too messy, but the answer should be laying on the surface.
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == self.regionsFirstTable) {
{ if (indexPath.row==0)
if (indexPath.section==1) {
[self performSegueWithIdentifier:@"toAfricanFS" sender:indexPath];
} else {
[self performSegueWithIdentifier:@"toAfricanFS" sender:indexPath];
}
if (indexPath.row==1)
if (indexPath.section==1) {
[self performSegueWithIdentifier:@"toAsiaFS" sender:indexPath];
} else {
[self performSegueWithIdentifier:@"toAsiaFS" sender:indexPath];
}
if (indexPath.row==2)
if (indexPath.section==1) {
[self performSegueWithIdentifier:@"toEuropeFS" sender:indexPath];
} else {
[self performSegueWithIdentifier:@"toEuropeFS" sender:indexPath];
}
if (indexPath.row==3)
if (indexPath.section==1) {
[self performSegueWithIdentifier:@"toLatinFS" sender:indexPath];
} else {
[self performSegueWithIdentifier:@"toLatinFS" sender:indexPath];
}
if (indexPath.row==4)
if (indexPath.section==1) {
[self performSegueWithIdentifier:@"toNorthAmericaFS" sender:indexPath];
} else {
[self performSegueWithIdentifier:@"toNorthAmericaFS" sender:indexPath];
}
} //Dealing with the first UITableView, it works
if (tableView == self.africaFirstTable) {
[self performSegueWithIdentifier:@"fromAfricatoDone" sender:indexPath];
}
if (tableView == self.asiaFirstTable) {
[self performSegueWithIdentifier:@"fromAsiatoDone" sender:indexPath];
}
if (tableView == self.europeFirstTable) {
[self performSegueWithIdentifier:@"fromEuropetoDone" sender:indexPath];
}
if (tableView == self.latinAmericaFirstTable) {
[self performSegueWithIdentifier:@"fromLatintoDone" sender:indexPath];
}
if (tableView == self.northAmericaFirstTable) {
[self performSegueWithIdentifier:@"fromNorthAmericatoDone" sender:indexPath];
} //This whole thing is not working as it should be
}
}
Thanks in advance!
P.S. All my tables have only one indexPath.section
It looks like you have too many
{s after your firstif, so all your checks forif ( tableView == self.northAmericaFirstTable)aren’t hitting because it is all nested within theif (tableView == self.regionsFirstTable)blockEDIT:
Here is the fixed code, theoretically