I have a UINavigationController in which I have to add a view controller to a view controller like so:
[self.navigationController addChildViewController:vc];
Because of this, when tapping the back button automatically generated for by my nab controller, it pops back to the main view, however it doesn’t remove the child view controller I added.
How can I check to remove or pop the child view controller at the same time at which the parent view controller pops?
Thanks.
The UINavigationControllerDelegate protocol has a method:
that is called whenever the nav controller changes a view controller. Implement this method, and do your logic there.