In iOS app, there may be several view controllers. They may perform segues from one to another. the question is how to detect each view controller about whether it is dismissed or not when implementing segue. Thanks.
Asked
Active
Viewed 2,560 times
2 Answers
1
You have access to:
override func viewWillDisappear(animated: Bool) {
}
override func viewDidDisappear(animated: Bool) {
}
// Called when the view controller will be removed from memory.
deinit {
}
Which can help you managed things based on that state of a view controller.

Fred Faust
- 6,696
- 4
- 32
- 55
-
Thanks man. sometimes even the view Disappear, it is still there. – James Rao Mar 15 '16 at 03:45
0
I'm not sure if you can detect whether or not it was dismissed, but you can set a variable "viewControllerDismissed = true" in performSegueWithIdentifier that will be detected in the VC behind the one being dismissed.

Dan Levy
- 3,931
- 4
- 28
- 48
-
Thanks Dan. Actually I am asking dismiss or dispose, not only disappear. I suppose that in some scene, when some segue is executed, the first view controller is still at the stack. For instance, when we perform a SHOW segue from first vc to second vc, the first vc is still there. While when back from second vc to first vc, the second vc is gone. My question is how to detect a view controller is totally disposed. – James Rao Mar 15 '16 at 03:28