Here is the scenario:
The first scene in my storyboard is login. This is a UIViewController. When the user is logged in, he shows a home view built into the navigation controller. I am adding a logout function, which should return me to the first scene in the storyboard, which is the kind of login. How to do it?
Here is a storyboard image showing the input view β navigation controller β home view 
This is my implementation. In the logout action, I clear the session and go to the root controller. This does not work, because I still stick to the home view, as this is the root view controller of the navigation controller. However, if I restart the application, the user will be logged out and I will remain with the login view.
the code:
[self.navigationController popToRootViewControllerAnimated:NO]; // Set at beginning of storyboard UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate]; app.loginViewController = [mystoryboard instantiateViewControllerWithIdentifier:@"loginViewController"];
ios objective-c storyboard
okysabeni
source share