簡體   English   中英

存在新控制器並關閉當前控制器時出現黑屏

[英]Black screen when present new controller and dismiss current controller

當前我有3個控制器,A,B和C。我在AController單擊一個按鈕,然后顯示BController ,然后在BController調用一個api,如果成功,我將轉到CController ,但是我想同時關閉BController時間。 然后我成功調用了CController另一個api,當我關閉CController ,希望屏幕返回到Acontroller 這三個控制器均不在導航控制器堆棧中。

我的實現:

BController ,調用presentViewController:(CController)方法和dismissViewController:(self) ,但是我失敗了,屏幕上沒有黑色的東西,希望有人可以幫助我解決這個問題。

謝謝!

然后執行以下操作:

1) A -> present B

2) B executes some method and if it is success -> delegate method to A, 
f.e (void)bControllerDidSuccess


3) in A Controller delegate method (void)bControllerDidSuccess: 
    A dismissViewController; // A dissmising B
    A presentViewController:C // A presenting C

只需按常規方法,並在要關閉CController時添加此行

    [self.navigationController popToRootViewControllerAnimated:YES];

請執行下列操作:

  • 來自A present B,帶有presentViewController:animated:completion:
  • 從B present C使用presentViewController:animated:completion:
  • 當在C上滿足條件時,只需使用dismissViewControllerAnimated:completion:消除C上的屬性“ presentingVIewController”,有效地消除B控制器,該控制器將自動關閉C,而您“着陸”在A控制器上

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM