禁止关闭 uipopoverview 控制器
当我们点击或触摸 popoverview
外部时,UIPopoverController
会自动关闭。 我想限制这种自动弹出窗口关闭。
UIPopoverController
automatically dismisses when we tap or touch outside the popoverview
.
I want to restrict this automatic popover dismissal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
重复的“是有没有办法在按下弹出窗口外部时不让弹出窗口消失?”
有一个非常简单且合法的解决方案。在呈现
UIPopoverController
的视图控制器中,遵循UIPopoverControllerDelegate
协议并实现以下委托方法。我刚刚测试了这个,它确实阻止了弹出窗口的关闭。只需确保您已将弹出窗口控制器的委托设置为实现此功能的视图控制器。
您可以使用
[popoverController DismissPopoverAnimated:NO];
方法关闭弹出窗口。Duplicate of "is there a way NOT to have the popover dismissed when pressing outside it?"
There is a very simple and legit solution. In the view controller that presents your
UIPopoverController
, conform to theUIPopoverControllerDelegate
protocol and implement the following delegate method. I just tested this and it does prevent popover to dismiss.Just make sure that you have set the delegate of your popover controller to the view controller that implements this.
You can dismiss the popover by using
[popoverController dismissPopoverAnimated:NO];
method.阅读 UIPopoverController文档。具体来说...
Have a read of the UIPopoverController documentation. Specifically...
在委托中实现
popoverControllerShouldDismissPopover:
,您可以阻止它消失,除非您希望它消失。Implement
popoverControllerShouldDismissPopover:
in the delegate, and you can stop it from disappearing unless you want it to.