2014-03-26 51 views
0

我想執行兩個不同的塞格斯每一個來自不同的UITableViews(在相同的ViewController)到另一個的ViewController。問題是,只有tableviews(processosActivosTV)之一是能夠執行SEGUE。我已經CTRL +拖動每個TableView中的兩個單元格原型到相同的VC。管理兩個UITableViews執行不同塞格斯

我對SEGUE準備是這樣的:

- (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"]; 

} 
} 

非常感謝您的幫助!

回答

0

不是CTRL +從細胞拖動到你的目的地viewcontrollers,CTRL +拖動從視圖控制器。

然後,在你

- (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]; 
    } 
} 
+0

感謝的人,它的工作就好了! – user3464645