title: prepareForSegue called before viewDidLoad
body: <p>I've tried seating SO and Google but it seems no one has had this issue. </p>
  
  <p>I have two <code>ViewControllers</code> in my iOS app.</p>
  
  <p>In <code>viewControllerA</code> on a tap event I call: </p>
  
  <pre><code>[self performSegueWithIdentifier:@"fooSegue" sender:self];
  </code></pre>
  
  <p>Which this calls: </p>
  
  <pre><code>-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  </code></pre>
  
  <p>on <code>viewControllerA</code></p>
  
  <p>No problem there. </p>
  
  <p>However after that method, </p>
  
  <pre><code>-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  </code></pre>
  
  <p>is called on <code>viewControllerB</code> before viewDidLoad is even called. I don't need this mothod to run on this <code>viewController</code> at this stage. Along with that, <code>viewDidLoad</code> / <code>viewWillApear</code> are called twice after the <code>prepareForSegue</code> has been called on <code>viewControllerB</code></p>
  
  <p>I tried doing a stack strace to see who is calling it - but this is what I got: </p>
  
  <pre><code>* thread #1: tid = 0x5eac3, 0x0001e859 TestApp`-[viewControllerB prepareForSegue:sender:](self=0x0dad98b0, _cmd=0x0188185a, segue=0x0ce9e6f0, sender=0x0dad98b0) + 89 at viewControllerB.m:444, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1   * frame #0: 0x0001e859 TestApp`-[ViewControllerB prepareForSegue:sender:](self=0x0dad98b0, _cmd=0x0188185a, segue=0x0ce9e6f0, sender=0x0dad98b0) + 89 at ViewControllerB.m:444
      frame #1: 0x015f8efa UIKit`-[UIStoryboardSegueTemplate _perform:] + 156
      frame #2: 0x015f8f87 UIKit`-[UIStoryboardSegueTemplate perform:] + 115
      frame #3: 0x011b32e2 UIKit`-[UIViewController loadViewIfRequired] + 605
      frame #4: 0x011b35d9 UIKit`-[UIViewController view] + 35
      frame #5: 0x011cd942 UIKit`-[UINavigationController _startCustomTransition:] + 778
      frame #6: 0x011da8f7 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 688
      frame #7: 0x011db4e9 UIKit`-[UINavigationController __viewWillLayoutSubviews] + 57
      frame #8: 0x0131c0d1 UIKit`-[UILayoutContainerView layoutSubviews] + 213
      frame #9: 0x01103964 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
      frame #10: 0x023e682b libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
      frame #11: 0x0286245a QuartzCore`-[CALayer layoutSublayers] + 148
      frame #12: 0x02856244 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
      frame #13: 0x028560b0 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
      frame #14: 0x027bc7fa QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 294
      frame #15: 0x027bdb85 QuartzCore`CA::Transaction::commit() + 393
      frame #16: 0x0287b5b0 QuartzCore`+[CATransaction flush] + 52
      frame #17: 0x010929bb UIKit`_UIApplicationHandleEventQueue + 13095
      frame #18: 0x02a1e77f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
  + 15
      frame #19: 0x02a1e10b CoreFoundation`__CFRunLoopDoSources0 + 235
      frame #20: 0x02a3b1ae CoreFoundation`__CFRunLoopRun + 910
      frame #21: 0x02a3a9d3 CoreFoundation`CFRunLoopRunSpecific + 467
      frame #22: 0x02a3a7eb CoreFoundation`CFRunLoopRunInMode + 123
      frame #23: 0x04bca5ee GraphicsServices`GSEventRunModal + 192
      frame #24: 0x04bca42b GraphicsServices`GSEventRun + 104
      frame #25: 0x01094f9b UIKit`UIApplicationMain + 1225    
      frame #26: 0x0011112d TestApp`main(argc=1, argv=0xbfffedf8) + 141 at main.m:16
  </code></pre>
  
  <p>I'm not sure what to make of this. </p>
  
  <p>Can anyone asset with whats going on here? </p>