title: ViewDidLoad and UINavigationController in iOS?
body: <p>I have an app which is based on a <code>UINavigationController</code>.  There is a menu screen with buttons that segue (push onto navigation controller stack) to one of 9 other "sub-screens".  None of these sub-screens segue to any other screen. When a user is done inputing data on a "sub-screen" they can press a done button which will pop back to the original menu screen.  (If you're having difficulty picturing this, imagine a tree like storyboard where there is one root ViewController and then 9 leaf viewControllers).</p>
  
  <p>Ok, so with that setup I have a few questions about how <code>viewDidLoad</code> works.</p>
  
  <p>~ First, is <code>viewDidLoad</code> supposed to be called every time we transition to a sub-screen. For example, suppose I go from the menu screen to sub-screen "B", back to the menu screen and then back to sub-screen "B". Should B's <code>viewDidLoad</code> method be called twice? If not, why might mine be getting called twice?</p>
  
  <p>~ Second, assuming that it will get called each time, what do I do if I have a lot of long operations that need to be performed exactly one time for each sub-screen? Where should I put them (if I put them in <code>viewDidLoad</code> it would happen multiple times if the user kept going back and forth between this page and the menu)?</p>