title: viewDidLoad called before prepareForSegue finishes
body: <p>I was under the impression that viewDidLoad will be called AFTER prepareForSegue finishes.  This is even how Hegarty teaches his Stanford class (as recently as Feb 2013).</p>
  
  <p>However, for the first time today, I have noticed that viewDidLoad was called BEFORE prepareForSegue was finished.  Therefore, the properties that I was setting in prepareForSegue were not available to the destinationViewController within the destinations viewDidLoad method.</p>
  
  <p>This seems contrary to expected behavior.</p>
  
  <p><strong><em>UPDATE</em></strong></p>
  
  <p>I just figured out what was going on.  In my destinationViewController I had a custom setter that would reload the tableView each time the "model" was updated:</p>
  
  <pre><code>DestinationViewController    
  - (void)setManagedObjectsArray:(NSArray *)managedObjectsArray
      {
          _managedObjectsArray = [managedObjectsArray copy];
          [self.tableView reloadData];
      }
  </code></pre>
  
  <p>It turns out, since the destinationViewController is a subclass of UITableViewController...calling 'self.tableView' forces the view to load.  According to Apple's documentation, calling the view property of a view controller can force the view to load.  The view of a UITableViewController is the tableView.</p>
  
  <p><a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html" rel="noreferrer">http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html</a></p>
  
  <p>Therefore, in prepareForSegue the following line was forcing the view of the destinationViewController to load:</p>
  
  <pre><code>vc.managedObjectsArray = &lt;custom method that returns an array&gt;;
  </code></pre>
  
  <p>To fix the problem, I changed the custom setter of the destinationViewController's model to:</p>
  
  <pre><code>- (void)setManagedObjectsArray:(NSArray *)managedObjectsArray
      {
          _managedObjectsArray = [managedObjectsArray copy];
          if ([self isViewLoaded]) {
              [self.tableView reloadData];
          }
      }
  </code></pre>
  
  <p>This will only reload the tableView if the tableView is on screen.  Thus not forcing the view to load during prepareForSegue.</p>
  
  <p>If anyone objects to this process, please share your thoughts.  Otherwise, I hope this prevents a long sleepless night for someone.</p>