In the below application you can see my current setup where the application launches and depending on whether the user is logged in or not a different uiviewcontroller is added as a subview of the main application [window addSubview:[loggedOutController view]];
My question is within -View1 (Login Screen), once the user attempts to login and it is successful, how can I go back to root level MainApplication and instead of loading the LoggedOut UIVIewcontroller now instead load in the LoggedIn UIViewController? It’s unclear to me how to communicate accross.
MainApplication
- UIViewController (Logged Out)
-UINavController
-View1 (Login Screen)
-View1a (Register Screen)
- UIViewController (Logged In)
-UITabBarController
-View1 (Settings)
-UINavController (Handle edit Profile Settings)
- View 1
-View 1a
-View 1b
-View 1c
-View2
I’m sure there are a multitude of ways to do this. One way to pass information between views is by setting a delegate object. So for instance, create a MainViewController delegate object in LoginScreen, and upon successful login, you can call
[delegate onSuccessfulLogin], which will can pop the view stack and run the LoggedIn view controller.