ios - 当选择另一个对象时是否有可能关闭弹出窗口 Controller ?

标签 ios ipad uipopovercontroller

我得到了一个 MapView,在其中通过推送 UIPopover Controller 编辑了注释的标注,并在其中添加了一些表格 View 。 我想实现不必单击,以便我的弹出窗口 Controller 在我例如时关闭。选择 map 上的另一个注释。是否有可能在不单击的情况下在后台启用这些对象?

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

最佳答案

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

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

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.

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

当您通过调用 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.

关于ios - 当选择另一个对象时是否有可能关闭弹出窗口 Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8399752/

相关文章:

ios - sharedApplication' 不可用 : not available on iOS (App Extension) - Use view controller based solutions where appropriate instead

ios - Xcode 导航栏、标签栏、 TableView 标题不显示

iphone - 你能用 Storyboard制作高级用户界面吗?

objective-c - UIWebView 缩放页面,无需水平滚动

iOS 视觉 : Drawing Detected Rectangles on Live Camera Preview Works on iPhone But Not on iPad

ios - 链接的 TTTAttributedLabel 和弹出窗口

ios - iOS enumerateChildNodeswithName访问所有物理实体

ios - 为 AVPlayer 设置用户代理

ios - 在 UIPopoverController 中以可变宽度显示 UITableViewController

ios - 如何在没有 View Controller 的情况下将选项卡栏项添加到 UITabBarController?