문제

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