2

我有以下情节提要设置

当用户点击保存按钮时,我需要从 BodyMapViewController 跳转到 MoleDetailsView 控制器(如图所示)

我可以使用非常简单的模态视图,但问题是我希望用户能够从 MoleDetailsView 返回到 MoleHistory 和 dermalHistory 视图

基本上我需要执行以下步骤:

  • 切换标签
  • 通过 DermalHistoryView 导航,然后通过 MoleHistoryView 导航到 MoleDetails 视图

故事板

4

1 回答 1

1

这个想法是您需要切换选项卡并手动修改视图层次结构,以便显示正确的视图。

首先,抓住控制另一个选项卡的导航控制器。这样,您就可以使用 NSMutableArray 实例化视图层次结构,如下所示:

-(void)pushToMoleDetailViewController:(id)detailItem
{

    UINavigationController *navCon = [self.navigationController.tabBarController.viewControllers objectAtIndex: 1];

    UIStoryboard *storyboard = self.storyboard;
    DermalHistoryViewController *dermalHistory = [storyboard instantiateViewControllerWithIdentifier:@"DermalHistoryViewController"]

    //configure dermal history here


    NSMutableArray *viewControllers = [[self navigationController].viewControllers mutableCopy];
    [viewControllers addObject: dermalHistory];

    MoleHistoryViewController *moleHistory = [storyboard instantiateViewControllerWithIdentifier:@"MoleHistoryViewController"]

    //configure mole history here
    [viewControllers addObject: moleHistory];

    MoleDetailsViewController *moleDetails = [storyboard instantiateViewControllerWithIdentifier:@"MoleDetailsViewController"]

    //configure mole details here
    [viewControllers addObject: moleDetails];



    navCon.viewControllers = viewControllers;
    self.navigationController.tabBarController.selectedIndex = 1;
}

看看这个问题: Push segue without animation

于 2013-06-22T06:44:42.530 回答