如何在 iOS 5 中关闭弹出窗口?
我在 iPad 的主端有一个 PatientTableViewController,其中有一个用于添加新患者的按钮。它通过popover segue转换到这个NewPatientViewController。
在 NewPatientViewController 中,我有一个“完成”按钮,该按钮委托回 PatientTableViewController:
- (void)newPatientViewController:(NewPatientViewController *)sender withZipCode:(NSNumber *)zipCode andFirstName:(NSString *)firstName andLastName:(NSString *)lastName
{
[self dismissViewControllerAnimated:YES completion:NULL];
[self dismissModalViewControllerAnimated:YES];
[sender dismissModalViewControllerAnimated:YES];
[sender dismissViewControllerAnimated:YES completion:NULL];
}
我上面尝试过的方法都不起作用。但是,如果我使用模态转场,一切都会正常。瓦?
I have a PatientTableViewController in the master side of the iPad that has a button for Adding a new patient. It transitions to this NewPatientViewController via a popover segue.
In the NewPatientViewController I have a Done button that delegates back to the PatientTableViewController:
- (void)newPatientViewController:(NewPatientViewController *)sender withZipCode:(NSNumber *)zipCode andFirstName:(NSString *)firstName andLastName:(NSString *)lastName
{
[self dismissViewControllerAnimated:YES completion:NULL];
[self dismissModalViewControllerAnimated:YES];
[sender dismissModalViewControllerAnimated:YES];
[sender dismissViewControllerAnimated:YES completion:NULL];
}
None of the methods I tried above work. However, if I use a Modal segue, everything works fine. Wat?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最后在这篇文章的帮助下弄清楚
基本上,你需要让一个变量跟踪segue(您需要将其转换为UIStoryboardPopoverSegue),并且还有更多的奇怪之处。
我写了一篇 博客文章 更详细地描述了该解决方案。
Finally figure it out with the help of this post
Basically, you need to have a variable keep track of the segue (which you need to cast into a UIStoryboardPopoverSegue) and little more weirdness.
I wrote a blog post describing the solution in more detail.
您是否在 UIPopoverController 类上尝试过
dismissPopoverAnimated:
?Did you try
dismissPopoverAnimated:
on UIPopoverController class?