title: how should I keep track of a detailViewController from a changing masterViewController?
body: <p><strong>Update</strong> - I think I figured it out but please read my question if you'd like and check that my solution (in answers) is correct, thank you.</p>
  
  <p>I'm new to the splitViewController and I'm having a hard time understanding how I should pop the detail view controller when the master is popped. </p>
  
  <p>This may be hard for me to explain but I will try my best, here is a screenshot to understand my storyboard:
  <img src="https://i.stack.imgur.com/9rTYE.png" alt="enter image description here"></p>
  
  <p>The MasterView is a NavigationController that has RootViewController of a TableView, when a user selects a cell the masterView pushes the next tableview and the detail is changed programmatically like so:</p>
  
  <p><strong>In the initial root:</strong></p>
  
  <pre><code>  detailViewController = (CCGViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];
  </code></pre>
  
  <p><strong>When a cell is clicked in root</strong></p>
  
  <pre><code> [detailViewController performSegueWithIdentifier:@"replaceSearchWithSponsor" sender:self];
  </code></pre>
  
  <p>This is working to drill down but when I pop the Master View navigation controller I'd like to set up a good way to pop the detail views in their navigation stacks.</p>
  
  <p>Any suggestions would be greatly appreciated.</p>
  
  <p>thank you.</p>