I have three View Controllers and want to go back from the third to the first on button click. I do the following:
- Add the target to my button:
doneButton.addTarget(self, action: #selector(ThirdViewController.doneButtonPressed(_:)), for: .touchUpInside)
- Create the action in the first controller:
@IBAction func unwindFromNewSubscription(segue: UIStoryboardSegue) { }
- Create the unwind segue linking it to the action from #2 in the storyboard and set the "chageFromNewToMain" identifier
- Create the action for my button in the third controller:
@IBAction func doneButtonPressed(_ sender:UIButton!) { print("DONE BUTTON PRESSED") performSegue(withIdentifier: "changeFromNewToMain", sender: self) }
And it works, BUT when I tap the button in V3 it instantly disappears and I see the animation: V2 slides down, so finally I can see the V1. But I want to animate the V3 to slide down instead of disappearing to see V1 after that. Any ideas how to fix that?
(V1, V2, V3 - View Controller 1, 2, 3)