Take the 2-minute tour ×

I need to know by notification or whatever when the user press outside the popover frame.


share|improve this question
Take a look at popoverControllerShouldDismissPopover: in the documentation. It might suit your needs. developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/… –  Kevin Horgan Jun 20 '12 at 15:37
add comment

1 Answer

up vote 6 down vote accepted

Why don't you implement UIPopoverControllerDelegate protocol?

Suppose you have a controller called MyController that displays the popover. In MyController.h says that it implements UIPopoverControllerDelegate like the following;

@interface DocumentViewController : UIViewController <UIPopoverControllerDelegate>

Now, in .m somewhere you could display the popover and set its delegate to self (it means that MyController will be the delegate for the popover).

UIPopoverController* pop = // init the popover here
pop.delegate = self;

At this point, you could implement the methods that are listed in that protocol (you must implement the required one, in general). In your case you could implement the following:

- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController
    // here I'm closing the popover...

- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
    // here I closed the popover...

For further info see UIPopoverControllerDelegate class reference.

Hope that helps.

share|improve this answer
Obviously in the first case, you need to return a BOOL value!! –  flexaddicted Jun 20 '12 at 15:47
add comment

Your Answer


