当选择另一个对象时是否有可能关闭弹出窗口控制器?

发布于 2024-12-20 03:58:45 字数 155 浏览 3 评论 0原文

我得到了一个 MapView,在其中通过推送 UIPopover 控制器编辑了注释的标注,并在其中添加了一些表格视图。 我想实现不必单击,以便当我在地图上选择另一个注释时,我的弹出窗口控制器会消失。是否有可能在不单击的情况下在后台启用这些对象?

有什么想法或建议来解决这个问题吗?

I got a MapView on which I edited the callout of my annotations through pushing a UIPopover Controller, on which i added some table views..
I would like to achive that I don't have to click so that my popover controller dismisses when I e.g. select another annotation on the map.. Are there any possibilities to enable these objects in background without clicking?

Any ideas or suggestions to solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨光如昨 2024-12-27 03:58:45

由于 UIPopoverController 被认为是模态的,因此默认行为是您所描述的行为:您必须首先关闭弹出窗口,然后才能与它下面的视图进行交互。

但是,您可以通过分配其 passthroughViews 属性来与弹出窗口下的视图进行交互:

UIPopoverController 类参考

显示时,点击弹出窗口外部会导致弹出窗口
会被自动解雇。为了让用户能够与
指定视图而不关闭弹出窗口,您可以指定一个或
passthroughViews 属性的更多视图。

passthroughViews

弹出窗口打开时用户可以与之交互的视图数组
可见。

@property(非原子,复制)NSArray *passthroughViews

讨论

当弹出窗口处于活动状态时,与其他视图的交互是
通常是禁用的,直到弹出窗口被关闭。分配一个数组
该属性的视图允许在弹出窗口之外进行点击
由相应的视图处理。

这样,您应该能够在弹出窗口显示时与 MapView 进行交互。

当您通过调用 dismissPopoverAnimated: 选择另一个注释时,您可以关闭当前显示的弹出窗口

dismissPopoverAnimated:

以编程方式关闭弹出窗口。

  • (void)dismissPopoverAnimated:(BOOL)动画

参数

animated 指定“YES”以动画方式关闭弹出窗口,或指定“NO”
立即驳回。

讨论

您可以使用此方法以编程方式关闭弹出窗口
响应弹出窗口内的点击。水龙头外部
弹出窗口的内容会自动关闭弹出窗口。

Since a UIPopoverController is considered modal, the default behaviour is the one you described: you must first close the popover before interacting with the view under it.

You can, however, interact with views under the popover by assigning its passthroughViews property:

UIPopoverController Class Reference:

When displayed, taps outside of the popover window cause the popover
to be dismissed automatically. To allow the user to interact with the
specified views and not dismiss the popover, you can assign one or
more views to the passthroughViews property.

passthroughViews

An array of views that the user can interact with while the popover is
visible.

@property (nonatomic, copy) NSArray *passthroughViews

Discussion

When a popover is active, interactions with other views are
normally disabled until the popover is dismissed. Assigning an array
of views to this property allows taps outside of the popover to be
handled by the corresponding views.

That way, you should be able to interact with your MapView while the popover is showing.

You can dismiss the currently showing popover when you select another annotation by calling dismissPopoverAnimated:

dismissPopoverAnimated:

Dismisses the popover programmatically.

  • (void)dismissPopoverAnimated:(BOOL)animated

Parameters

animated Specify YES to animate the dismissal of the popover or NO to
dismiss it immediately.

Discussion

You can use this method to dismiss the popover programmatically in
response to taps inside the popover window. Taps outside of the
popover’s contents automatically dismiss the popover.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文