iOS Segues with Popover 有不良的默认行为
我在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果弹出窗口已存在,请使用
prepareForSegue:
方法关闭该弹出窗口。这里给出了如何使用该方法。
Use
prepareForSegue:
method to dismiss the pop over if it is already present.Here is given, how to use that method.
防止多个弹出窗口:
使用 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.