title: Detect when a presented view controller is dismissed
body: <p>Let's say, I have an instance of a view controller class called VC2.  In VC2, there is a "cancel" button that will dismiss itself.  But I can't detect or receive any callback when the "cancel" button got trigger.  VC2 is a black box.</p>
  
  <p>A view controller (called VC1) will present VC2 using <code>presentViewController:animated:completion:</code> method.</p>
  
  <p>What options does VC1 have to detect when VC2 was dismissed?</p>
  
  <p>Edit:  From the comment of @rory mckinnel and answer of @NicolasMiari, I tried the following:</p>
  
  <p>In VC2:</p>
  
  <pre><code>-(void)cancelButton:(id)sender
  {
      [self dismissViewControllerAnimated:YES completion:^{
  
      }];
  //    [super dismissViewControllerAnimated:YES completion:^{
  //        
  //    }];
  }
  </code></pre>
  
  <p>In VC1:</p>
  
  <pre><code>//-(void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
  - (void)dismissViewControllerAnimated:(BOOL)flag
                             completion:(void (^ _Nullable)(void))completion
  {
      NSLog(@"%s ", __PRETTY_FUNCTION__);
      [super dismissViewControllerAnimated:flag completion:completion];
  //    [self dismissViewControllerAnimated:YES completion:^{
  //        
  //    }];
  }
  </code></pre>
  
  <p>But the <code>dismissViewControllerAnimated</code> in the VC1 was not getting called.</p>