本文介绍了然后在不显示中间视图控制器的情况下展开segue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个 UIViewControllers 其中A - > B - > C,A - > D.

I have three UIViewControllers where A -> B -> C, and A -> D.

当用户在CI中完成时想要退回到A然后切换到D,但是在没有简单地显示A之前我无法使其工作,而是在发生到D之后。我已尝试禁用segue的动画属性,但A仍然会在视图中闪烁不到一秒钟。

When the user is done in C I want to unwind back to A and then segue to D, but I cannot get this to work without briefly showing A before the segue to D happens. I have tried disabling the animates property for the segue but A still flashes into view for less than a second.

关于如何解决这个问题的任何想法?

Any idea as to how I can fix this?

推荐答案

在swift 3中试用此代码: -

Try this Code in swift 3 :-

   let oldVCs = self.navigationController?.viewControllers! as NSArray
   let newVCs = NSMutableArray()

   // Add your root VC in new array of VCs
   newVCs .add(oldVCs?[0])
   // Add your new VC just after your root VC
   newVCs .add("Your New VC")

   self.navigationController?.setViewControllers(newVCs, animated: true)

这篇关于然后在不显示中间视图控制器的情况下展开segue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 13:39