Olufsen
Olufsen

Reputation: 160

Go back to previous page using unwind segue

I wanted to just go back to my previous page from Attendance in going to Leave and Leave back to Attendance

LeaveViewController.swift

@IBAction func LeaveAttendanceSequeConnect(_ sender: Any) {
        performSegue(withIdentifier: "LeaveAttendanceSegue", sender: nil)
    }

Attendance.swift

 @IBAction func LeaveUnwindSeque(segue: UIStoryboardSegue){

    }

and then on my Leave Scene I have ctrl drag to Exit

after ctrl drag to exit

Pressing the Back button in Leave wont go back to Attendance

Upvotes: 0

Views: 268

Answers (2)

claude31
claude31

Reputation: 884

The signature of the unwind is incorrect.

@IBAction func LeaveUnwindSeque(segue: UIStoryboardSegue){
    }

replace with

@IBAction func LeaveUnwindSeque(_ segue: UIStoryboardSegue){
    }

Upvotes: 1

paul dan
paul dan

Reputation: 74

The segue should work without needing another segue to leave the unwind. Try this:

1) Keep your original LeaveAttendanceSequeConnect (which should have been bound with ctrl drag from your view controller in story board over to your corresponding .swift file).

2)Get rid of the LeaveUnwindSeque code and unbind that rewind segue properly by deleting the segue (p.s. is segue with a "g" not seque). Now click on the segue connection of the LeaveAttendanceSequeConnect in the storyboard. Make sure the original navigation controller has attributes and looks the same on the storyboard like figures A) and then make sure your second segue has attributes/storyboard like figure B).

A attribute:

Figure A storyboard

B attribute:

Figure A attributes

B storyboard:

Figure B storyboard

A: storyboard:

Figure B attributes

Upvotes: 2

Related Questions