简体   繁体   English

从弹出窗口释放Segue

[英]Unwind Segue from popup

I have UIViewController A, UIVC B, and A has a segue to B. (Using a button) B has an "OK" button that pops up a window, and once I click "Accept" in the pop up, I want it to return back to UIVC A, or back to be upon "Cancel". 我有UIViewController A,UIVC B,并且A对B有要求。(使用按钮)B有一个“确定”按钮,它弹出一个窗口,一旦我在弹出窗口中单击“接受”,我就希望它返回到UIVC A,或返回“取消”。 Now, the cancel part is easy. 现在,取消部分很容易。 How do I implement the returning back to A? 如何实现返回A?

In viewcontroller A: 在视图控制器A中:

@IBAction func unwindToViewControllerA(segue:UIStoryboardSegue) { }

In ViewController B: 在ViewController B中:

@IBAction func dismissClicked(_ sender: Any) {
     performSegue(withIdentifier: "unwindToViewControllerA", sender: self)
}

Make sure you create a named Segue called: unwindToViewControllerA , this I does by control - clicking to the EXIT icon (rather than the next view controller when you create a normal segue) 确保创建了一个名为Segue的名为: unwindToViewControllerA ,这是我通过控制来完成的-单击EXIT图标(而不是创建普通segue时的下一个视图控制器)

This link has a full, awesome explanation about how it needs to be done. 该链接对需要完成的操作进行了完整,出色的解释。

https://www.andrewcbancroft.com/2015/12/18/working-with-unwind-segues-programmatically-in-swift/ https://www.andrewcbancroft.com/2015/12/18/working-with-unwind-segues-programmatically-in-swift/

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

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