簡體   English   中英

消除解雇ViewController和展示新ViewController之間的延遲

[英]Remove delay between dismissing viewcontroller and presenting new viewcontroller

我已經成功解雇了一個視圖控制器,並提出了一個新的視圖控制器,但是新的視圖控制器在稍有延遲之后就出現了。 如何消除該延遲? 我當前的代碼是:

 UIViewController * vcb=self.presentingViewController;

 [self dismissViewControllerAnimated:YES completion:^{

      UIStoryboard * storyBoard=[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
      ContactsViewController * VC=[storyBoard instantiateViewControllerWithIdentifier:@"contactsView"];

      [vcb presentViewController:VC animated:YES completion:nil];

}];

您必須指出不需要動畫過渡。 將您的代碼更改為...

 UIViewController * vcb=self.presentingViewController;

 [self dismissViewControllerAnimated:YES completion:^{

      UIStoryboard * storyBoard=[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
      ContactsViewController * VC=[storyBoard instantiateViewControllerWithIdentifier:@"contactsView"];

      [vcb presentViewController:VC animated:NO completion:nil];

}];

而且,如果您需要酒糟延遲,請嘗試...

 UIViewController * vcb=self.presentingViewController;

 [self dismissViewControllerAnimated:NO completion:^{

      UIStoryboard * storyBoard=[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
      ContactsViewController * VC=[storyBoard instantiateViewControllerWithIdentifier:@"contactsView"];

      [vcb presentViewController:VC animated:NO completion:nil];

}];

暫無
暫無

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

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