I have an application in which if I already have a user's
You do it, in essence, exactly the same way you do it in the app delegate. But you are not in the app delegate, so you have to get there in steps:
From the UIApplication class you can get a reference to the
shared application object.
From there you can get the app's
From there you can get the app delegate's
Now you can set the window's
The view controller that was the root view controller will vanish in a puff of smoke, along with all its dependent view controllers.
(This, however, is not quite how I would do it. I would have a stable root view controller whose only job is to be custom parent view controller to either the LoginViewController or the MainViewController. I'm not fond of the idea of changing root view controller's in the middle of the app. Still, it's not illegal.)