ipad弹出窗口问题

发布于 2024-10-14 19:31:54 字数 328 浏览 7 评论 0原文

我有一个委托文件,一个视图控制器和一个UIPopoverController

我的PopoverController是在委托文件中定义的。

当我单击视图控制器的按钮时,会显示弹出窗口。

视图控制器还包含一种名为“refreshviewnow”的方法。

当我单击 PopoverController“提交按钮”时,我想调用该 refreshviewnow 函数。

我应该在提交按钮事件上写什么?

I have one delegate file, one View Controller and one UIPopoverController

My PopoverController is defined in delegate file.

when I click on the view controller's button, the popover is shown.

The view controller also contains one method named "refreshviewnow".

When I click on the PopoverController "submit button", I want to call that refreshviewnow function.

What should I have to write on submit button event ?

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

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

发布评论

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

评论(3

一抹淡然 2024-10-21 19:31:54

您需要确保并将 PopoverController 的委托属性设置为视图控制器。然后在“提交按钮”中,您可以调用委托上的方法。

- (void) submit {
   [delegate refreshAction];
}

祝你好运。

You need to make sure and set the delegate property of the PopoverController to the View Controller. Then in the "submit button" you can invoke the method on the delegate.

- (void) submit {
   [delegate refreshAction];
}

Good Luck.

蹲在坟头点根烟 2024-10-21 19:31:54

我不确定“提交按钮”是什么意思(也许您应该发布一些您正在使用的代码),但是如果您尝试调用同一控制器中的方法,您会这样做:

- (void) methodToDisplayPopover
{
    [self refreshViewNow];
}

编辑:

MySecondView *second = [[MySecondView alloc] init];
[second refreshViewNow];
[second release];

I am not sure what you mean by "submit button" (maybe you should post some of the code you are using), but if you are trying to call a method that is in the same controller, you would do it like this:

- (void) methodToDisplayPopover
{
    [self refreshViewNow];
}

EDIT:

MySecondView *second = [[MySecondView alloc] init];
[second refreshViewNow];
[second release];
无语# 2024-10-21 19:31:54

我现在得到了答案。

View Controller文件中为方法refreshviewnow添加观察者

当弹出窗口将要关闭时发布通知。

I got the answer now.

add observer in View Controller file for method refreshviewnow.

post the notification when popover is going to dismiss.

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