如何在 iOS 5 中关闭弹出窗口?

发布于 2025-01-04 17:00:17 字数 745 浏览 2 评论 0原文

我在 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 技术交流群。

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

发布评论

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

评论(2

苍暮颜 2025-01-11 17:00:17

最后在这篇文章的帮助下弄清楚

基本上,你需要让一个变量跟踪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.

橘寄 2025-01-11 17:00:17

您是否在 UIPopoverController 类上尝试过 dismissPopoverAnimated:

Did you try dismissPopoverAnimated: on UIPopoverController class?

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