简体   繁体   English

展开到ViewController的特定实例

[英]Unwind to specific instance of ViewController

I have a ViewController that I'm just re-instantiating to navigate to another instance of it (there's a reason for this) with the following code: 我有一个ViewController,我将通过以下代码重新实例化以导航到它的另一个实例(这是有原因的):

let viewController = storyboard.instantiateViewControllerWithIdentifier("CompletionViewController") as! CompletionViewController
self.navigationController?.pushViewController(viewController, animated: true)

Everything works fine, except when I try to unwind... since every instance of the control has the unwind method: 一切正常,除非我尝试展开...,因为控件的每个实例都有unwind方法:

@IBAction func unwindToThisViewController(segue: UIStoryboardSegue) {}

It ends up unwinding to the last instance of the VC instead of the first (which is what I want), for example: 它最终将展开到VC的最后一个实例,而不是第一个(这就是我想要的),例如:

vc1 > vc2 > vc3 > unwind from here

I want to unwind to "vc1", but it actually unwinds to "vc3". 我想展开为“ vc1”,但实际上展开为“ vc3”。

Is there anyway that I can unwind to the first instance of the VC; 无论如何,我可以放松到VC的第一个实例吗? or like in my example "vc1"? 还是像我的示例中的“ vc1”?

in your CompletionViewController , there are 3 icons at the top of the view. 在您的CompletionViewController ,视图顶部有3个图标。 if you CTRL drag from the left yellow icon to the right red one (the "exit") you can choose your unwinding segues. 如果您从左侧的黄色图标CTRL拖动到右侧的红色图标(“退出”),则可以选择放松的步态。 Now you can use that unwind in your code ;) 现在您可以在代码中使用该展开;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM