1

从popoverview呈现的PrestedViewController,这是我正在使用的代码

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);

控制器打开正常,当我尝试关闭控制器时,我收到此警告

“警告:在演示或关闭过程中尝试从视图控制器中关闭!”

之后,如果我单击任何按钮,应用程序将崩溃。

这是我用来关闭视图的代码

[self dismissViewControllerAnimated:YES completion:nil];

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

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

当我尝试关闭弹出视图本身时,会收到相同的警告

4

2 回答 2

0

一开始是正确的线下。

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

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

选择任何一种演示风格,

 ConDetVC.modalPresentationStyle = UIModalPresentationPageSheet;
 ConDetVC.modalPresentationStyle = UIModalPresentationFormSheet;

页面表或表单表。

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

 [self presentViewController:ConDetVC animated:YES completion:nil]; 

当它被解雇时,只需写,

 [self dismissViewControllerAnimated:YES completion:^{
         // write you code here
     }];
于 2014-08-01T05:30:20.480 回答
0

这将帮助您:

 [self.presentedViewController dismissViewControllerAnimated: YES completion:^(void) {
             [self presentViewController:myController animated:YES completion:nil];
    }];
于 2014-08-25T15:14:28.440 回答