关闭弹出窗口 - Objective-c

发布于 2024-12-06 10:22:34 字数 726 浏览 2 评论 0原文

美好的一天,

我在选择一行(UITableView)后关闭弹出窗口时遇到问题。我尝试过以下方法,但没有成功。

[self dismissModalViewControllerAnimated:YES];

iMAPClientesPesquisar *a = [[iMAPClientesPesquisar alloc] init];
    [a.popover dismissPopoverAnimated:YES];

我将我的弹出框称为如下:

- (IBAction)Filtro:(id)sender {

    iMAPClientesFiltro *ClientesFiltro = [[iMAPClientesFiltro alloc] init];
    popover = [[UIPopoverController alloc] initWithContentViewController:ClientesFiltro];
    [ClientesFiltro release];
    [popover setPopoverContentSize:CGSizeMake(132, 132)];
    [popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}

任何建议将不胜感激。

Good Day,

I'm having a problem to close a popover after selecting a line (UITableView). I've tried the following methods, but were unsuccessful.

[self dismissModalViewControllerAnimated:YES];

iMAPClientesPesquisar *a = [[iMAPClientesPesquisar alloc] init];
    [a.popover dismissPopoverAnimated:YES];

I'm calling my popover as follows:

- (IBAction)Filtro:(id)sender {

    iMAPClientesFiltro *ClientesFiltro = [[iMAPClientesFiltro alloc] init];
    popover = [[UIPopoverController alloc] initWithContentViewController:ClientesFiltro];
    [ClientesFiltro release];
    [popover setPopoverContentSize:CGSizeMake(132, 132)];
    [popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}

Any suggestion will be greatly appreciated.

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

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

发布评论

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

评论(2

江湖正好 2024-12-13 10:22:34

如果您尝试从 Filtro 方法所在的同一视图控制器关闭弹出窗口(或者换句话说,弹出窗口将是该类中可见的变量),您应该能够删除“a”。从上面的行开始,只需执行以下操作:

[popover dismissPopoverAnimated:YES];

If you are trying to close the popover from the same view controller that the Filtro method is in (or in other words, popover would be an variable visible from within that class), you should be able to drop the "a." from your above line and just do:

[popover dismissPopoverAnimated:YES];
柠檬心 2024-12-13 10:22:34

关闭弹出窗口的唯一方法是引用打开的弹出窗口。我有点困惑为什么你要调用 [self DismissModalViewControllerAnimated:YES]; 因为这与 UIPopoverController 无关。

您需要使用原始弹出窗口引用来关闭弹出窗口。类似 [popover dimissPopoverAnimated:YES]; 因为 popover 似乎是具有最初打开弹出窗口的函数的对象的成员变量。

The only way to dismiss the popover is to have a reference to the popover that is open. I'm a little confused why you are calling [self dismissModalViewControllerAnimated:YES]; as that has nothing to do with a UIPopoverController.

You need to use the original popover reference to dismiss the popover. Something like [popover dimissPopoverAnimated:YES]; since popover appears to be a member variable of the object that had the function that originally opened the popover.

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