我想从不同的UITableViews(在同一个ViewController上)到另一个ViewController执行两个不同的segue。问题是只有一个tableviews(processosActivosTV)能够执行segue。我将每个TableView中的两个单元格原型ctrl +拖动到同一个VC中。
我对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 :(得分:0)
不是按住ctrl +从单元格拖动到目标视图控制器,而是从视图控制器中按住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];
}
}