iosobjective-ciphoneuipopoverpresentationcontroller

PopoverPresentationController not getting dismissed on touching outside


I have a PopoverPresentationController which shows from the button like below.

enter image description here

enter image description here

I want to dismiss this popup on clicking outside popup. It should not dismiss on clicking inside popup. Below is my code.

_popup = [self.storyboard instantiateViewControllerWithIdentifier:@"PopupViewController"];
_popup.modalPresentationStyle = UIModalPresentationPopover;
_popup.popoverPresentationController.sourceView = self.button;
_popup.modalInPopover = TRUE;

[self presentViewController:_popup animated:TRUE completion:nil];

How do I do that?


Solution

  • Delete this line:

    _popup.modalInPopover = TRUE;