将触摸传递给 UIPopoverController 的底层按钮
我有一个带有“取消”按钮的模态视图(该按钮关闭模态)。 在模态中,我正在推一个小的 UIPopover。
我想要实现的是:
当 UIPopover 可见时,如果 uset 触摸“取消”,它将同时执行以下操作:
- 隐藏弹出窗口(现在正在发生,因为这是弹出窗口外部的单击)
- 隐藏模式 - 就像用户触摸“取消”一样没有弹出窗口
有办法吗?
UIPopoverControllerDelegate 没有提供任何帮助(或者我没有看到它:))
谢谢:)
I've got a modal view that has "Cancel" button (the button dismisses modal).
In the modal, I'm shoving a small UIPopover.
What I'm trying to achieve is:
When the UIPopover is visible, if uset touches "Cancel" it will do both:
- hide popover (it's happening now, since that's the click outside popup)
- hide modal - as if user touched "Cancel" without popup
Is there a way to do it?
UIPopoverControllerDelegate is not providing any help (or I'm not seeing it :) )
Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在呈现弹出窗口之前,将“取消”按钮添加到弹出窗口的 passthroughViews 数组中:
这将使“取消”按钮在显示弹出窗口时响应触摸,而不会自动关闭弹出窗口。
然后,在“取消”按钮的操作方法中,在关闭模态视图之前调用弹出窗口上的
dismissPopoverAnimated:
。您需要在 ivar 中保留对 popover 的引用(例如 popoverController)才能执行此操作。
Before presenting the popover, add the Cancel button to the popover's passthroughViews array:
This will let the Cancel button respond to touches while the popover is displayed without automatically dismissing the popover.
Then in your Cancel button's action method, call
dismissPopoverAnimated:
on the popover before dismissing the modal view.You'll need to keep a reference to the popover in an ivar (eg. popoverController) to do this.