PopoverPresentationController不会在触摸外部时被解雇

时间:2018-11-21 05:38:59

标签: ios objective-c iphone uipopoverpresentationcontroller

我有一个PopoverPresentationController,它从如下按钮显示。

enter image description here

enter image description here

我想在单击外部弹出窗口时关闭此弹出窗口。单击内部弹出窗口时不应关闭它。下面是我的代码。

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

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

我该怎么做?

1 个答案:

答案 0 :(得分:2)

删除此行:

_popup.modalInPopover = TRUE;