How to add viewcontrollers to my navigation controller?
ios, objective-c, uinavigationcontroller, uiviewcontroller
Solution
If you know exactly what you want your stack of view controllers to be, then you can just set them directly.
For example, let's say I want the views on a navigation controller to start out as OverView > TableView > NewItemView. I want people to create their first entry as soon as they start the app. In my navigation controller I only need to do the following in `-application:didFinishLaunchingWithOptions:`.
NSArray *stack = [NSArray arrayWithObjects:overViewController, tableViewController, newItemViewController, nil];
navController.viewControllers = stack;
Please note, this removes the old stack completely. Any view controllers in the navigation view controller will be lost.
Problem
I am developing an application in which I am using a `UINavigationController` in the `AppDelegate`. At launch, I initialise it with a `UIViewController`. ``` self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; [self.navigationController setNavigationBarHidden:YES]; [window addSubview:self.navigationController.view]; like this. ``` However, I would like to add other `UIViewControllers` to the `UINavigatioNController`, but I know that it isn't good practise to re-initialise the `UINavigationController` each time I would like to use the other `UIViewControllers`. Please can you tell me the normal way of doing this?