Objective-C 多个 popoverviewcontroller
我在 UIView 中有多个 popovercontroller。 我可以为一个弹出窗口调用 popoverControllerDidDismissPopover 方法,但无法为所有弹出控制器执行相同的操作。
有人可以建议我,我怎样才能实现这一目标?
I have multiple popovercontroller in a UIView.
I am able to call popoverControllerDidDismissPopover method for one popover but unable to do the same for all the popovercontrollers.
Can anybody suggest me, how can I achieve this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能打电话是什么意思?您是否继承了 UIPopoverController 并自己调用该方法?
如果您的意思是“当我的弹出窗口被关闭时它不会被调用”,我们需要更多信息。这是某些情况下的指定行为。让我引用文档中的内容:
如果您有多个弹出窗口并且想知道哪一个刚刚被关闭,则必须在方法本身中进行比较。
根据您的评论进行编辑:
该方法总是称为
popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
。此方法由用户关闭的任何弹出窗口触发。如果您有两个需要不同终结的不同弹出窗口,则必须在此方法中区分它们。这就是为什么它有参数,弹出窗口在其中放置self
,一个指向自身的指针。你的方法应该是这样的:
What do you mean you're able to call? Did you subclass UIPopoverController, and call the method yourself?
If you mean "it isn't called when my popovers are dismissed", we need more information. This is specified behavior in some circumstances. Let me quote from the docs:
If you have multiple popovers and want to know which one has just been dismissed, you'll have to do a comparison in the method itself.
EDIT based on your comment:
The method is always called
popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
. This method is triggered by any popover that is dismissed by the user. If you have two different popovers that need different finalization, you have to differentiate between them within this method. This is why it has the parameter, in which the popovers putself
, a pointer to themselves.Your method should look like this: