uipopoverControllerからプレゼントしている間にPreventedViewControllerを閉じる
-
26-12-2019 - |
質問
PresentedViewController 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];
.
ポップオーバービュー自体を閉じようとすると、同じ警告が入っています
解決
は、下の最初の正しい行です。
SearchPropertyVC *SearchPropertyVC *centerViewController = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];
SearchPropertyVC *searchPropertyVC = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];
.
1つのプレゼンテーションスタイルを選択し、
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];
}];
. 所属していません StackOverflow