停止UIPopover自动解除 [英] Stop UIPopover from dismissing automatically

查看:105
本文介绍了停止UIPopover自动解除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法阻止iPad popover在弹出窗口外触摸屏幕时自动解除?如果没有,是否有某种类似于popoverDidDismiss的方法,我可以在弹出窗口被解除时调用它?

I was wondering if there was a way to stop an iPad popover from dismissing automatically whenever you touch the screen outside the popover? If not, is there some kind of method similar to "popoverDidDismiss" that I could call to tell when the popover was dismissed?

推荐答案

是的,你可以。这完全取决于Apple文档。

Yes you can. This is right out of the Apple documentation.

当popover视图之外的用户点击弹出时,弹出窗口会自动通知其委托人。如果您提供委托,则可以使用此对象来防止解除弹出窗口或执行其他操作以响应解雇。 popoverControllerShouldDismissPopover:委托方法可让您控制是否应该实际解除弹出窗口。如果您的委托没有实现该方法,或者您的实现返回YES,则控制器解除该弹出窗口并向该委托发送 popoverControllerDidmissisPopover:消息。

When a popover is dismissed due to user taps outside the popover view, the popover automatically notifies its delegate of the action. If you provide a delegate, you can use this object to prevent the dismissal of the popover or perform additional actions in response to the dismissal. The popoverControllerShouldDismissPopover: delegate method lets you control whether the popover should actually be dismissed. If your delegate does not implement the method, or if your implementation returns YES, the controller dismisses the popover and sends a popoverControllerDidDismissPopover: message to the delegate.

只需向委托方法返回NO popoverControllerShouldDismissPopover:

Just return NO to the delegate method popoverControllerShouldDismissPopover:

这是一个链接进一步阅读。

Here is a link for further reading.

弹出指南

这篇关于停止UIPopover自动解除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆