Reputation: 5023
I'm using a navigationController in my app. One UI i have tried to click one button (Not in Navigation bar) viewWillDisappear is not called. But i'm not using the navigationController it's calling the viewWillDisappear. Can you please help me how to call the viewWillDisappear with a navigationController?
Upvotes: 0
Views: 6530
Reputation: 10175
So, first of all - (void)viewWillDisappear:(BOOL)animated
is a method specific to UIViewController
class.
Second, this method shouldn't be called directly from the code, this method is called automatically when a UIViewController
is removed from a view hierarchy. (check UIViewController specs)
So in order to handle this method call, you have to implement it in your custom UIViewController
class (do not forget to call [super viewWillDisappear:animated]
). Whenever your custom UIViewController
view will disappear from the screen (is popped from the stack or other UIViewController
is added to the stack) this method will be called.
Upvotes: 1