I am making a view based application in which the first controller is viewcontroller there is login screen ,after login the next view is tabbar controller and I have 2 tabbar items on that tabbar .
Until this everything works fine . Now when i switch between these two views the viewWillDisappear, viewDidUnload is not called of previous tab clicked .
P.S.Even the viewwillAppear was not called ,which i called it with the Default Notification. Don’t know what the issues are. Hope I am clear with my question.
First of all, when switching view in a UITabBarController, the
viewDidUnloadfunction is not called because the view is not actually unloaded. So, this is normal.What should work out of the box is
viewWillAppear/viewDidDisappear. But there is a catch.Depending on how you show your views, it might be that
viewWillAppear/viewDidDisappearare not called by the framework for you. For example, this happens if you add your view as a subview, but there are more cases. I don’t know how you display your tab bar, so cannot say anything more specific about it.The easy solution I suggest to fix this is overriding the
tabBarController:didSelectViewController:selector in you tab bar controller delegate. From there you could implement you own logic or callviewDidDisappear.