title: How can I detect when a view controller has been dismissed?
body: <p>How can I detect back in my mapview (master) controller that the detail view controller has been dismissed?  I have a mapview with pins and annotations.  When the rightCalloutAccessoryView has been tapped on any annotation, a modal detail view controller is called via performSegueWithIdentifier. Incidentally, I don't know if this is correct or not, but the master and detail view controllers are attached by a navigation controller. </p>
  
  <p>My goal is to take conditional action back on the mapview (master view) based on the user action on the detail view controller.  Specifically if they have tapped the Remove Pin feature, I want to remove the pin when control returns to the mapview.  If they simply tap the Done button, then I want the pin and annotation to remain on the screen.  </p>
  
  <p>With my limited knowledge, I'm able to remove the pin with the second line below but the problem is that I can see that the pin and annotation is removed right after the rightCalloutAccessorView icon is tapped and before the detail view is displayed.  So what that means is that if the user then taps the Done button on the detail screen, they would then return to the mapview with the pin and annotation removed already.  I only want it removed if the user taps the Remove button.</p>
  
  <pre><code>   [self performSegueWithIdentifier:@"PinDetail" sender:self];
     [self.mapView removeAnnotation:MA];
  </code></pre>
  
  <p>So my question really are:</p>
  
  <ol>
  <li>Where do I put in the removeAnnotation code? In it's current place, the removal of the pin takes place even before the detail view appears.</li>
  <li>How can I detect if the Remove button on the detail view has been tapped?</li>
  </ol>
  
  <p>Thanks.</p>