从另一个视图关闭 UIPopoverController
我在另一个视图中有一个名为 popover
的 UIPopoverController
。我想知道的是,如果在当前弹出窗口视图中按下 UIButton
,如何关闭弹出窗口?提前致谢。
I have a UIPopoverController
named popover
in another view. What I would like to know is, how can I dismiss the popover if a UIButton
was pressed in the current popover view? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我总是觉得奇怪的是,UIViewController 通过它的“contentSizeForViewInPopover”属性知道它在弹出窗口中应该有多大,但不保留指向 UIPopoverController 本身的指针。我总是最终添加:
到我的 UIViewController 类中,并在创建弹出窗口时进行设置。然后,从 UIViewController 中的任何内容,我可以执行以下操作来关闭弹出窗口:
I always found it odd that a UIViewController knows how big it should be in a popover through it's "contentSizeForViewInPopover" property, but doesn't keep a pointer to the UIPopoverController itself. I always end up adding:
to my UIViewController classes, and set that when creating the popover. Then from anything in that UIViewController, I can do this to dismiss the popover:
您可以使用 NSNotification< /a> 告诉另一个视图关闭它的弹出视图。
用法示例:
You could use an NSNotification to tell the other view to dismiss it's popover view.
Example usage: