Search code examples
objective-ciosuipopovercontroller

Don't Dismiss UIPopoverController when tap off


after a bit of searching, I couldn't find an answer to something that seems like it would be useful to many.

Is there a way to make a UIPopoverController not dismiss when the user clicks somewhere on the outside? I want the user to have to use a cancel button (Yes, i realize this probably violates Apple's HIG somehow, but it's a rare case and makes sense from a User experience perspective).

Thanks for any help.


Solution

  • You can do hit-tests on where the tap occurred and in your popover's delegate return NO. - (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController