【问题标题】:prepareforSegue method on UITableViewControllersUITableViewControllers 上的 prepareforSegue 方法
【发布时间】:2014-03-01 06:01:25
【问题描述】:

我使用了两个tableviewcontrollers,我想在其中显示国家名称数组数据 第一个 tableviewcontroller (recipeBookTableViewController) 和第二个 tableviewcontroller (RecipetableviewController) 中的其他大写数组数据, 当单击第一个 tableviewcontroller 单元格时,它应该移动到第二个 tableviewcontroller 并带有大写数组数据。

我已采取prepareforSegue 方法转移到第二个tableview。但该方法从未被调用。
如何将数据发送到下一个tableview

RecipeBookViewController(table1)            Recipetableview(table2)
  INDIA (cell)                    ------------>      Delhi(cell)



- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{
   if ([segue.identifier isEqualToString:@"showRecipeDetail"]) 
   {
      NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];


      RecipeDetailViewController *destViewController = segue.destinationViewController;
      destViewController.second = [onew objectAtIndex:indexPath.row];
      NSLog(@"%@",onew);
      NSLog(@"data is %@",destViewController.second);
      //  destViewController.lable2 = [derivationArray objectAtIndex:indexPath.row];
      //  destViewController.image = [iconArray objectAtIndex:indexPath.row];


   }
}

【问题讨论】:

    标签: ios iphone objective-c storyboard


    【解决方案1】:

    问题在于创建segue。

    确保您已经创建了从第一个表的单元格到第二个 viewController 的 segue。

    将segue命名为showRecipeDetail

    看下图:

    【讨论】:

    • 感谢重播,但请您解释一下如何解决这个问题
    • 答案本身就是一种解释。 @PavanAlapati
    • @preetam 感谢您的回答
    猜你喜欢
    • 2011-12-25
    • 2023-04-04
    • 1970-01-01
    • 2011-12-29
    • 1970-01-01
    • 2013-02-19
    • 2013-12-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多