Gundam Gundam - 6 months ago 18
Swift Question

here segue from two view to one view, how to unwind segue to?

segue screenshot

screenshot above is 2 segue; from (view1 or view2) to view3

may i use back method in below method?

@IBAction func backview1(segue: UIStoryboardSegue) {

} // code in view1.swift
@IBAction func backview2(segue: UIStoryboardSegue) {

} // code in view2.swift


Should i do add code in view3.swift?
then how coding back segue method in view3.swift in order to go back to origin view?

Answer

If you name the function you are returning to the same in both viewControllers, then you will be returned to the one that called VC3.

For example, put this in both VC1 and VC2:

@IBAction func backFromVC3(segue: UIStoryboardSegue) {

}

Then, when you create your unwind segue, just choose backFromVC3 from the pop-up.

Comments