Unwind then segue without showing intermediate view controller

走远了吗. 提交于 2019-12-01 10:56:58

问题


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

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?


回答1:


Try this Code in 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)


来源:https://stackoverflow.com/questions/45792130/unwind-then-segue-without-showing-intermediate-view-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!