I have one difficulty with the root view controller.
enter image description here Picture(1)
Within the below code and the picture 1, everything work fine. But within picture 2 enter image description here Picture (2), I got an error said that
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BannerViewController topViewController]: unrecognized selector sent to instance 0x7feb9b64dbc0'
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UINavigationController *navController = tabBarController.viewControllers[0];
ItemListTableViewController *itemList = (ItemListTableViewController *)navController.topViewController;
itemList.managedObjectContext = self.managedObjectContext;
return YES;
}
So please help me how to insert a view controller in front of the navigation controller?
You can get a reference to the navigation controller through the
childViewControllers
property of the container VC: