title: How can I observe when UIPopoverController is dismissed?
body: <p><code>UISplitViewController</code> has the delegate method:</p>
  
  <pre class="lang-c prettyprint-override"><code>-(void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController
  </code></pre>
  
  <p>I'm looking to obtain functionality from a similar, but non-existent, delegate method:</p>
  
  <pre class="lang-c prettyprint-override"><code>-(void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willDismissViewController:(UIViewController *)aViewController
  </code></pre>
  
  <p>Thoughts on the best way to do this considering <code>UISplitViewController</code>/<code>UIPopoverController</code>/<code>UIKit</code> in general aren't KVO compliant, so I can't add an observer to <code>UIPopoverController</code>'s <code>isPopoverVisible</code> property.</p>
  
  <p>Thanks</p>
  
  <h2>Answer:</h2>
  
  <pre class="lang-c prettyprint-override"><code>//Sent when switching to portrait
  - (void)splitViewController:(UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController:(UIPopoverController*)pc
  {  
      ...
  
      self.popoverController = pc;
      [self.popoverController setDelegate:self];
  }
  
  -(void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController
  {
      NSLog(@"SHOWING POPOVER");
  }
  
  - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
  {
      NSLog(@"HIDING POPOVER");
  }
  </code></pre>