首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在PresentedViewController离开UIPopoverController时解雇UIPopoverController

在PresentedViewController离开UIPopoverController时解雇UIPopoverController
EN

Stack Overflow用户
提问于 2014-08-01 04:39:43
回答 2查看 1.1K关注 0票数 1

弹出的PresentedViewController,这是我正在使用的代码

代码语言:javascript
复制
SearchPropertyVC *SearchPropertyVC *centerViewController = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];
UINavigationController *ConDetVC = [[UINavigationController alloc] initWithRootViewController:centerViewController];
ConDetVC.modalPresentationStyle = UIModalPresentationPageSheet;
ConDetVC.modalPresentationStyle = UIModalPresentationFormSheet;
ConDetVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentViewController:ConDetVC animated:YES completion:nil];
ConDetVC.view.superview.bounds = CGRectMake(0, 0, 700, 670);

控制器打开的很好,当我试图关闭控制器时,我会收到这个警告

“警告:试图在演示文稿或解职过程中从视图控制器中解职!”

之后,如果我点击任何按钮,应用程序就会崩溃。

这是我用来拒绝视图的代码

代码语言:javascript
复制
[self dismissViewControllerAnimated:YES completion:nil];

[self dismissViewControllerAnimated:YES completion:^{
             [(UINavigationController *)self.presentingViewController popToRootViewControllerAnimated:YES];
         }];

if (![self.presentedViewController isBeingDismissed])
            [self dismissViewControllerAnimated:YES completion:nil];

当我试图取消popover视图本身时,会得到相同的警告

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-08-01 05:30:20

在第一次修正以下线。

代码语言:javascript
复制
 SearchPropertyVC *SearchPropertyVC *centerViewController = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];

 SearchPropertyVC *searchPropertyVC = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];

选择任何一种表达方式,

代码语言:javascript
复制
 ConDetVC.modalPresentationStyle = UIModalPresentationPageSheet;
 ConDetVC.modalPresentationStyle = UIModalPresentationFormSheet;

页表或表单页。

当您尝试呈现时,请使用想要呈现的视图对象控制器。

代码语言:javascript
复制
 [self presentViewController:ConDetVC animated:YES completion:nil]; 

当它被驳回的时候,只需写信,

代码语言:javascript
复制
 [self dismissViewControllerAnimated:YES completion:^{
         // write you code here
     }];
票数 0
EN

Stack Overflow用户

发布于 2014-08-25 15:14:28

这将帮助你:

代码语言:javascript
复制
 [self.presentedViewController dismissViewControllerAnimated: YES completion:^(void) {
             [self presentViewController:myController animated:YES completion:nil];
    }];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25072971

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档