【问题标题】:PopoverPresentationController not getting dismissed on touching outsidePopoverPresentationController 在触摸外部时不会被解雇
【发布时间】:2018-11-21 05:38:58
【问题描述】:

我有一个 PopoverPresentationController,它从下面的按钮中显示。

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

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

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

我该怎么做?

【问题讨论】:

    标签: ios objective-c iphone uipopoverpresentationcontroller


    【解决方案1】:

    删除这一行:

    _popup.modalInPopover = TRUE;
    

    【讨论】:

    • 如果我删除该行,则弹出窗口会在单击它内部时消失,但不会在外部单击。
    • 嗯,根据您告诉我们的内容,我无法重现。你隐藏的其他事情正在发生。
    • 好吧,我不知道 Xcode 的古怪之处。但是在删除此行并强制清理项目后,它起作用了。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-28
    • 2013-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多