关闭弹出窗口 - Objective-c
美好的一天,
我在选择一行(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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您尝试从 Filtro 方法所在的同一视图控制器关闭弹出窗口(或者换句话说,弹出窗口将是该类中可见的变量),您应该能够删除“a”。从上面的行开始,只需执行以下操作:
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:
关闭弹出窗口的唯一方法是引用打开的弹出窗口。我有点困惑为什么你要调用
[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];
sincepopover
appears to be a member variable of the object that had the function that originally opened the popover.