I am new to iOS development and I try to create an app that has a login view and after successful login it presents a tab bar menu with 3 items.
Menu item 1: is the default one that appears when the tab bar is loaded.
Menu item 2: is an application form. After successful application submission, it loads the default menu item using the code below.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
UIViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"Default_Menu"];
[self presentViewController:vc animated:YES completion:nil];
Menu item 3: is the logout and it is supposed to load the login screen with the following code:
[self dismissViewControllerAnimated:NO completion:nil];
[self.navigationController popToRootViewControllerAnimated:YES];
The problem is (I guess) that after a successful form submission and the subsequent reloading of the default menu item, a new view hierarchy is created. The result is that after a successful form completion, selecting "Logout" leads to the view just before the form submission (text fields are appeared completed with user's input etc). A second "Logout" seems to lead to the login view but this is not the desired behaviour (one logout selection should be enough).
Are there any ideas on how I can stay on the desired view hierarchy and access the initial login view immediately?