The best way is not to use segue directly from IB, but instead to use it tableview:didSelectRowAtIndexPath:and manually call them from the code whenever they select a row in the table.
You should configure segues from the table view itself to the destinations, not the specific elements from the table.
Something like that:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *identifierOfSegueToCall;
if (indexPath.row < 3) {
identifierOfSegueToCall = @"theFirstViewControllerSegueIdentifier";
} else {
identifierOfSegueToCall = @"theSecondViewControllerSegueIdentifier";
}
[self performSegueWithIdentifier:identifierOfSegueToCall sender:self];
}
source
share