1

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?

Bhavesh
  • 1,422
  • 1
  • 12
  • 31

1 Answers1

2

Delete this line:

_popup.modalInPopover = TRUE;
matt
  • 515,959
  • 87
  • 875
  • 1,141
  • If I delete that line then popup dismisses on clicking inside it but no clicking outside. – Bhavesh Nov 21 '18 at 06:04
  • Well I can’t reproduce that based on what you’ve told us. Something else is going on that you have concealed. – matt Nov 21 '18 at 06:09
  • Well, I don't know the weirdness of Xcode. but after deleting this line and force cleaning project, it worked. Thanks – Bhavesh Nov 21 '18 at 06:13