介绍viewcontroller出现在popoverview中,这是我正在使用的代码

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

当我尝试解雇了popover视图本身得到相同的警告

有帮助吗?

解决方案

在第一个正确的线条上。

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

其他提示

这将有助于您:

 [self.presentedViewController dismissViewControllerAnimated: YES completion:^(void) {
             [self presentViewController:myController animated:YES completion:nil];
    }];
.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top