title: How do I prevent UIPopoverController passthroughViews from being reset after orientation change when presented from a UIBarButtonItem?
body: <p>I have a UIPopoverController which is being presented from a UIBarButtonItem. I want touches outside of the popover to dismiss the popover. When presenting a popover from a bar button, the other bar buttons are automatically included in the popovers passthrough views. In order to prevent that I set the passthrough views to nil (or @[ ]) after presenting the popover, like so:</p>
  
  <pre><code>- (IBAction) consoleBarButtonHit:(id)sender {
  UIViewController *consoleNavigationController=[self.storyboard instantiateViewControllerWithIdentifier:@"consoleNavigationController"];
  _consolePopoverController=[[UIPopoverController alloc] initWithContentViewController:consoleNavigationController];
  _consolePopoverController.delegate=self;
  
  [_consolePopoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
  
  // this must be done _after_ presenting the popover in order to work
  _consolePopoverController.passthroughViews=nil;
  }
  </code></pre>
  
  <p>That's all fine and good, but <strong>the problem that I'm having is that after rotating the device while the popover is visible the bar buttons are being automatically re-added as passthrough views and don't cause the popover to be dismissed</strong>.</p>
  
  <p>If I could somehow get the bar buttons view (or rect) then I could present the popover using</p>
  
  <pre><code>-presentPopoverFromRect:inView:permittedArrowDirections:animated:
  </code></pre>
  
  <p>which would likely fix this problem, but I don't know of any non-hackish way of finding that rect/view from a UIBarButtonItem.</p>
  
  <p>I really don't want the selectors called when the other bar buttons are hit to dismiss the popover programmatically, that's not their responsibility and will likely cause problems for me later.</p>
  
  <p>Any ideas?</p>