I want to perform two different segues each one from different UITableViews (on the same ViewController) to another ViewController. The problem is that only one of the tableviews (processosActivosTV) is able to perform the segue. I've ctrl + drag both cell prototypes in each TableView to the same VC.

My prepare for segue looks like this:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

NSLog(@"-------------------------------------------------------prepare detalhes---------------------------------------------------------------------");
if ([segue.identifier isEqualToString:@"activos"]) {

    NSIndexPath *indexPath = [self.processosActivosTV indexPathForSelectedRow];
    lxvListagemDetailViewController *destViewController = segue.destinationViewController;
    destViewController.estadoProcessoStr = [[activos objectAtIndex:indexPath.row] objectForKey:@"ESTADO"];
    destViewController.numProcessoStr = [[activos objectAtIndex:indexPath.row] objectForKey:@"NUM_PROCESSO"];
    destViewController.morada = [[activos objectAtIndex:indexPath.row] objectForKey:@"MORADA"];
    destViewController.operacao = [[activos objectAtIndex:indexPath.row] objectForKey:@"OPERACAO_URBANISTICA"];
    destViewController.tipologia = [[activos objectAtIndex:indexPath.row] objectForKey:@"TIPOLOGIA"];

} else if ([segue.identifier isEqualToString:@"arquivados"]){


    NSLog(@" -------------------------------------------------------prepare arquivados ---------------------------------------------------------------------");

    NSIndexPath *indexPath = [self.processosArquivadosTV indexPathForSelectedRow];
    lxvListagemDetailViewController *destViewController2 = segue.destinationViewController;
    destViewController2.estadoProcessoStr = [[arquivados objectAtIndex:indexPath.row] objectForKey:@"ESTADO"];
    destViewController2.numProcessoStr = [[arquivados objectAtIndex:indexPath.row] objectForKey:@"NUM_PROCESSO"];
    destViewController2.morada = [[arquivados objectAtIndex:indexPath.row] objectForKey:@"MORADA"];
    destViewController2.operacao = [[arquivados objectAtIndex:indexPath.row] objectForKey:@"OPERACAO_URBANISTICA"];
    destViewController2.tipologia = [[arquivados objectAtIndex:indexPath.row] objectForKey:@"TIPOLOGIA"];

}
}

Thanks a lot for the Help!

有帮助吗?

解决方案

Instead of ctrl + drag from your cell to your destination viewcontrollers, ctrl + drag from your view controller.

Then, in your

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //... do other regular stuff

    if (pushingOneDestController) {
        [self performSegueWithIdentifier:@"activos" sender:cell];
    }
    else (pushingAnotherDestController) {
        [self performSegueWithIdentifier:@"arquivados" sender:cell];
    }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top