不调用 popoverControllerDidDismissPopover 方法 [英] popoverControllerDidDismissPopover method is not called

查看:29
本文介绍了不调用 popoverControllerDidDismissPopover 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有一个 presentViewController,在它里面我有一个可以打开弹出框的按钮.在这个弹出窗口中,我有一个 barButtonItem 来保存这个弹出窗口的数据.我希望当用户在弹出窗口之外点击时,数据也可以被保存.我尝试在 presentViewController 视图中使用 popoverControllerDidDismissPopover 方法.我有委托,但是当我在弹出窗口之外点击时,不会调用此方法.

In my application I have a presentViewController, and inside it I have a button that opens a popover. In this popover I have a barButtonItem to save de data of this popover. I would like that when the user taps outside of the popover, the data could be saved too. I've tried to use the popoverControllerDidDismissPopover method in the presentViewController view. I have the delegate but when I tap outside of the popover this method is not called.

我能做什么?

谢谢!!

推荐答案

请注意文档!

"当用户采取行动关闭弹出框时调用委托.以编程方式关闭弹出窗口时不会调用此方法."

"Called on the delegate when the user has taken action to dismiss the popover. This is not called when the popover is dismissed programmatically."

这是我的情况,因为我的弹出窗口使用此方法关闭按钮点击:

It was my case because my popover was closing on button tap with this method:

dismiss(animated: true, completion: nil)

这篇关于不调用 popoverControllerDidDismissPopover 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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