【问题标题】:Managing two UITableViews to perform different segues管理两个 UITableView 来执行不同的 segue
【发布时间】:2014-03-26 17:05:55
【问题描述】:

我想从不同的 UITableViews(在同一个 ViewController 上)到另一个 ViewController 执行两个不同的 segues。问题是只有一个 tableviews (processosActivosTV) 能够执行 segue。我已经 ctrl + 将每个 TableView 中的两个单元格原型拖动到同一个 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"];

}
}

非常感谢您的帮助!

【问题讨论】:

    标签: ios objective-c uitableview segue uistoryboardsegue


    【解决方案1】:

    不是 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];
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-29
      • 1970-01-01
      相关资源
      最近更新 更多