ipad 检测 UIPopoverController 何时被关闭
我的通用 iPad 应用程序中有几个 uiPopoverController。我现在需要在某个弹出窗口被关闭后触发一个函数。如果用户在弹出窗口内单击“关闭”,我可以轻松执行此操作,但如果他们触摸屏幕以隐藏弹出窗口,我将无法触发我的功能。
我已经用谷歌搜索了一段时间,似乎找不到任何我可以在主视图控制器中使用的委托方法来捕获它们。我喜欢像 didDismissPopoverController 这样的东西 - 但我的猜测是它不可用。
如果没有,我想唯一要做的就是检测触摸并触发?基本上我突出显示 UITableView 行并加载弹出窗口。我需要取消选择该行 - 所以想简单地调用 [table reloaddata]。
感谢您对此的任何帮助!
I have several uiPopoverControllers in my universal iPad app. I now have a requirement to trigger a function once a certain popover has been dismissed. I can do this easily if the user clicks "close" inside the popover, but if they touch the screen to hide the popover, I cannot trigger my function.
I've been googling for some time and cannot seem to find any delegate methods which I might be able to use in my main view controller to capture them. I would love something like didDismissPopoverController - but my guess is it's not available.
IF not, I guess the only thing to do would be to detect the touches and trigger then? Basically I am highlighting a UITableView row and loading the popover. I need to deselect the row - so want to simply call [table reloaddata].
Thanks for any help on this one!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要为
UIPopoverController
分配一个委托,然后实现- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
方法。例如:当您实例化
UIPopoverController
时(例如,在FooController
中)...然后,您将实现该方法:
当然,我还没有测试过但这似乎应该有效...
希望这有帮助!
You need to assign a delegate to the
UIPopoverController
and then implement the- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
method. For example:When you instantiate the
UIPopoverController
(say, for this example, inFooController
)...Then, you would implement the method:
Granted, I haven't tested this but it seems like it should work...
Hope this helps!
您可以在进行以下分配后使用 popoverControllerDidDismissPopover 委托方法:
self.popoverController.delegate = self;
请注意,如果您以编程方式调用 [self.popoverController DismissPopoverAnimated:YES],则不会调用 popoverControllerDidDismissPopover 委托方法。
You can use the popoverControllerDidDismissPopover delegate method after the following assignment:
self.popoverController.delegate = self;
Note that popoverControllerDidDismissPopover delegate method does not get called if you programmatically call [self.popoverController dismissPopoverAnimated:YES].