Push a viewcontroller using UINavigationController sometimes calls viewDidAppear: and viewWillAppear:
UINavigationController calls these methods directly on the controller, which is called when pushViewController: animated: is called, similarly, UITabBarController calls these methods directly when switching tabs, and UIViewController calls them when using presentModalViewController: animated :. They are also called when a view controller view is added to the window. I've never seen these methods not be called in these specific contexts.
Now, keep in mind that these methods are only called when a controller is clicked or presented in these specific contexts. These methods will not be called, for example, if you add a view controller view as a subview of some kind other than UIWindow. Apple documentation states that view controllers are only intended to be used with full-screen views, which are typically presented using one of the methods described above. It is possible to ignore Apple's advice and map a view controller to the view controller of another view controller, but you will have to delegate the viewWill / DidAppear / Disappear calls from the container's view controller to the nested controller manually.
a source to share
Make sure the function name is correct, for example:
- (void)viewWillAppear:(BOOL)animated
For example, if you forgot to declare an animated parameter, your function will not be called.
It may seem obvious, but I made this mistake, and since the original post does not have any sample code, I thought I would share!
a source to share