Home > OS >  UIKit Programmatically: Architecture For Nested Navigation
UIKit Programmatically: Architecture For Nested Navigation

Time:04-04

I have a bunch of screens in an app:

Login screen (NavigationController - rootViewController)
  |
  Tab bar navigation controller
   |
    -- Dashboard Screen (NavigationController)
        |
         -- Details Screen (Child of dashboard)
   |
    -- Recipes Screen(Navigation Controller)

So login screen is a UINavigationController, and after login I push a viewcontroller which is a UITabBarController, with 2 screens, each screen is a UINavigationController (Dashboard screen, and Recipes screen).

I am not sure this is the right way of navigation architecture, but it solves the problem of not showing the tab bar at the Login screen, and only after login the tab bar is showing up.

I have a logout button on the Dashboard screen, and I am trying to go all the way back to the Login screen, but it doesn't work as the Login screen isn't in the navigation stack. How can I pop all the way back to the Login screen? Should I organize my navigation differently?

CodePudding user response:

One idea is:

  1. You could present the UITabBarController from the first UINavigationController instead of pushing it

  2. Then from your dashboard screen, you can dismiss to go back to the login screen

I have also outlined some more ideas here on how to manage some complex navigation flows

  • Related