iOS Segues with Popover 有不良的默认行为

发布于 2024-12-22 19:09:12 字数 288 浏览 3 评论 0原文

我在 Segues 方面遇到了一个奇怪的问题 - 当点击 UIButton 时,我有一个 Segue 打开一个弹出窗口,所有这些都是通过 IB 完成的。 (这是在 iPad 上)

但是当我从这个弹出窗口的 Tableview 中选择一个选项时,我希望它关闭弹出窗口。如果用户点击 UIButton 两次,我不希望弹出窗口打开两次。

默认情况下,点击 UIButton 会“永远”在彼此之上打开弹出窗口,而且我仍然遇到以下问题:点击我的 Tableview 中的一个单元格,弹出窗口仍然存在。

我该如何解决这些问题?

I've got a weird issue with segues - I have a segue open a popover when a UIButton is tapped, all of this done through IB. (This is on iPad)

But when I select an option from the Tableview on this popover I want it to dismiss the popover. And I don't want the popover to open twice if the user taps that UIButton twice..

The way things work by default, tapping that UIButton keeps opening popovers on top of each other "forever" and also I still have the issue that when a cell from my Tableview is tapped, the popover remains.

How can I solve these problems?

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

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

发布评论

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

评论(2

跨年 2024-12-29 19:09:15

如果弹出窗口已存在,请使用 prepareForSegue: 方法关闭该弹出窗口。

这里给出了如何使用该方法。

Use prepareForSegue: method to dismiss the pop over if it is already present.

Here is given, how to use that method.

忆离笙 2024-12-29 19:09:15

防止多个弹出窗口:

使用 if 语句确定弹出窗口是否存在,如果不存在,则不存在。

点击单元格时关闭:

在 didSelectRowAtIndexPath 中,在弹出窗口视图上调用 DismissPopover。

Prevent multiple popovers:

Use an if statement to determine whether a popover is present or not, if it isn't present it, if it is don't.

Dismiss on cell tap:

In didSelectRowAtIndexPath call dismissPopover on your popover view.

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