然后在不显示中间视图控制器的情况下展开segue

时间:2017-08-21 08:08:53

标签: ios uiviewcontroller uistoryboardsegue unwind-segue

我有三个UIViewControllers,其中A - > B - > C和A - >; d。

当用户在C中完成时,我想要退回到A然后转到D,但是如果没有简单地显示A之前我不能让它工作,直到D发生。我已经尝试禁用segue的animates属性,但A仍然会在不到一秒的时间内闪现。

我知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:3)

在swift 3中尝试此代码: -

let oldVCs = self.navigationController?.viewControllers
var newVCs = [UIViewController]()

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

self.navigationController?.setViewControllers(newVCs, animated: true)
相关问题