In my application, when the user presses the back button on the navigation bar, I want the program to trigger some action. Therefore, I had been using
viewDidDisappear for the same. You can check the apple documentation here. This notifies the view controller when its view is removed from a view hierarchy.