I want to save DB when the back button clicked in navigation controller.
so I would insert code in method.
What method is called when back button clicked in
Maybe it's not appropriate use, but that worked for me. Don't forget to set UINavaigationController delegate.
- (id )navigationController:(UINavigationController *)navigationController
animationControllerForOperation:(UINavigationControllerOperation)operation
fromViewController:(UIViewController *)fromVC
toViewController:(UIViewController *)toVC
{
NSLog(@"from VC class %@", [fromVC class]);
if ([fromVC isKindOfClass:[ControllerYouJustPopped class]])
{
NSLog(@"Returning from popped controller");
}
return nil;
}