I'm facing an odd problem concerning pushing a UIViewController into a UINavigationController.
CustomTableViewController is a subclass of UITableViewController
CustomTableViewController* vc = [[CustomTableViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *navVC = [[UINavigationController alloc] initWithRootViewController:vc];
[self.view addSubview:navVC.view];
For some reason, the Navigation Controller is loaded and visible on screen but viewDidLoad is never called on CustomTableViewController.
Manually pushing the VC afterwards also does not work (still not loading the vc's view)
[navVC pushViewController:vc animated:YES];
However, the following methods DO call viewDidLoad on vc:
[self.view addSubview:vc.view];[self presentViewController:navVC animated:YES completion:nil];[self presentViewController:vc animated:YES completion:nil];
So I tend to believe that there is nothing wrong with the View Controller nor the Navigation Controller. However, I have no clue why the view is not being loaded. Manually forcing [vc view] will load the view but then the other view lifecycle methods are not called.
There is also nothing wrong with CustomTableViewController, as using UITableViewController itself also doesn't work.
Any ideas?
navVCinto theviewControllersarray on yourUITabBarController- Paulw11