title: iOS: how to detect if viewcontroller appears after pop or dismiss
body: <p>I have a view controller VC1 and I am doing following two operations on it:</p>
  
  <ol>
  <li>Push another view controller VC2 from VC1's navigation controller by calling</li>
  </ol>
  
  <p><code>[VC1.navigationController pushViewController: animated:YES];</code></p>
  
  <ol start="2">
  <li><p>Present another view controller VC3 from VC1 by calling.</p>
  
  <p><code>UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:VC3];
  [VC1 presentViewController:navController animated:YES completion:nil];</code></p></li>
  </ol>
  
  <p>Now when I am coming from VC2 to VC1 I am calling </p>
  
  <p><code>[VC2.navigationController popViewControllerAnimated:YES];</code></p>
  
  <p>and from VC3 to VC1 I am calling</p>
  
  <p><code>[VC3.navigationController dismissViewControllerAnimated:YES completion:nil];</code></p>
  
  <p>My question is when I am coming back to VC1 how do I know that whether I am coming from VC2(by dismissing) or VC3(by popping)?</p>
  
  <p>Note: VC1 is loaded as child view controller inside a parent view controller VC4. </p>