[英]viewWillAppear of parent triggered when second presented viewcontroller dismissed
我有3個ViewController,比方說AVC,BVC和CVC
首先,我介紹AVC的BVC,然后介紹BVC的CVC
因此,層次結構為AVC-> BVC-> CVC。
當我從BVC中取消CVC時,會觸發AVC的viewWillAppear
,如何防止調用AVC的viewWillAppear
?
謝謝
更新
首次出席(在AVC中)
BTViewController *BTVC = [self.storyboard instantiateViewControllerWithIdentifier:@"BTVCIns"];
__weak BTViewController *weakBTVC = BTVC;
BTVC.dismissAction = ^{[weakBuyTicketVC dismissViewControllerAnimated:YES completion:nil];};
[BTVC setModalPresentationStyle:UIModalPresentationOverCurrentContext];
[self presentViewController:BTVC animated:YES completion:nil];
第二件禮物(在BVC中)
PMViewController *PMVC = [self.storyboard instantiateViewControllerWithIdentifier:@"PMVCIns"];
__block PMViewController *blockPMVC = PMVC;
blockPMVC.dismissAction = ^{[blockPMVC dismissViewControllerAnimated:YES completion:nil];};
blockPMVC.delegate = self;
[self presentViewController:PMVC animated:YES completion:nil];
當使用UIModalPresentationFullScreen樣式顯示視圖控制器時,UIKit通常會在過渡動畫完成后刪除基礎視圖控制器的視圖。 您可以通過指定UIModalPresentationOverCurrentContext樣式來防止刪除這些視圖。 當顯示的視圖控制器具有透明區域以使基礎內容顯示出來時,您可以使用該樣式。
由於您使用的是UIModalPresentationOverCurrentContext
,因此iOS認為BVC可能具有暴露AVC的透明區域,因此,當BVC出現時,AVC也可能會出現,因此調用viewWillAppear
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.