2014-11-08 50 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: