James Rao
James Rao

Reputation: 170

How to detect view controller dismissed or not

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.

Upvotes: 1

Views: 2593

Answers (2)

Fred Faust
Fred Faust

Reputation: 6790

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.

Upvotes: 1

Dan Levy
Dan Levy

Reputation: 4281

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.

Upvotes: 0

Related Questions