如何在iOS 5中关闭popovers? [英] How to dismiss popovers in iOS 5?

查看:137
本文介绍了如何在iOS 5中关闭popovers?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPad的主屏幕中有一个 PatientTableViewController ,其中有一个用于添加新病人的按钮。

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.

NewPatientViewController 中,我将转换到 NewPatientViewController 具有委派回 PatientTableViewController 的完成按钮:

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];
}

上面尝试的方法都没有。但是,如果我使用模态segue,一切工作正常。 Wat?

None of the methods I tried above work. However, if I use a Modal segue, everything works fine. Wat?

推荐答案

最后,借助这个帖子

基本上,你需要一个变量跟踪

Basically, you need to have a variable keep track of the segue (which you need to cast into a UIStoryboardPopoverSegue) and little more weirdness.

我写了一个 readncode.com/blog/how-to-dismiss-popovers-in-ios/\">博文更详细地描述解决方案。

I wrote a blog post describing the solution in more detail.

这篇关于如何在iOS 5中关闭popovers?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆