title: Proper way to implement a login process in iOS apps
body: <p>When a user run my app for the first time a LoginViewController appears. Once he is logged in, I present a ModalViewController with all the stuff of the app. If the user want to log out, I dismiss the modal view, showing the LoginViewController again.</p>
  
  <p>The problem comes if the user runs the app when is already logged. In the self.window.rootViewController, I set directly the main view of the app (embebed in a <code>UITabBarController</code>), so if the user want to log out, I don't know the way to "dismiss" the view and show the LoginViewController.</p>
  
  <p>SCENARIO:</p>
  
  <ul>
  <li>User no logged yet: LoginViewController -> (Log in) -> <code>UITabBarController</code> -> (Log out) -> LoginViewController.</li>
  <li>User already logged: <code>UITabBarController</code> -> (Log out) -> LoginViewController.</li>
  </ul>
  
  <p>I think there must be a simple way to do this, because it is a very normal behavior in an app with a login system, but I haven't found a clean way to do it.</p>