我有 6 个不同的表,当其中一个表中的行被选中时(在 regionFirstTable 中重要的是哪个表),我希望它们执行一个 segue。regionFirstTable 的代码工作正常,但至于另一部分它没有 - segues 只是不工作。我知道这太混乱了,但答案应该是表面上的。
- (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
}
}
提前致谢!
PS我所有的表只有一个 indexPath.section