2014-11-08 32 views
0

我的应用程序流程如下,其中A,B,c和D是视图控制器。 箭头标记呈现从和查看控制器。iOS App navigation

enter image description here

现在我需要在B,C和d视图控制器的家按钮导航回A.我没有使用故事板 。 其中,我无法使用dismissviewcontroller,因为它只解雇一次,在某些情况下,它需要2或3个先前的视图控制器解雇。

在这方面的任何建议将有所帮助。

回答

1

这听起来像你应该使用A作为一个UINavigationController你的根视图控制器。 B,C和D唯一需要做的就是致电popToRootViewController

您需要让您的登录视图控制器从A推送,但您可以在用户看不到它的情况下执行此操作,方法是将代码放在AppDelegate中(这可能是您检查用户无论如何都需要登录)。

+0

谢谢@ user3574459 – raheem52 2014-11-10 06:08:11

0

如何使用setViewControllers:animated :.无论你在哪里,你都会得到第一个视图控制器firstViewController = [self.navigationController viewController] firstObject],然后[self.navigationController setViewControllers:@ [firstViewController] animated:YES]。

在这里看到:setViewControllers:animated: