First of all, when switching a view to a UITabBarController, the viewDidUnload function viewDidUnload not called because the view is not actually unloaded. So this is normal.
What should work out of the box viewWillAppear / viewDidDisappear . But there is a catch. Depending on how you display your views, it may be that viewWillAppear / viewDidDisappear not called by the framework for you. For example, this happens if you add your view as a subtitle, but there are more cases. I donβt know how you display the tab bar, so you cannot say anything more specific about this.
A simple solution, I propose to fix this, is overriding the tabBarController:didSelectViewController: selector in your tab bar controller delegate. From there, you can implement your own logic or call viewDidDisappear .
source share