PopoverPresentationController not getting dismissed on touching outside

244 views Asked by At

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?

1

There are 1 answers

3
matt On BEST ANSWER

Delete this line:

_popup.modalInPopover = TRUE;