I'm trying to revise an app I did in iOS a few months ago that uses a navigation controller.
My goal is to replace the current default view controller with a new one (which will in turn call the original view controller)
In trying to tease apart what has to happen in order to do this. I've created a new view controller and the corresponding nib, and set them up as variables in the app delegate. In the app delegate, this is the current code which makes the call to the "old" initial view:
navController.viewControllers = [NSArray arrayWithObject:questionViewController]; [window addSubview:navController.view]; [self.window makeKeyAndVisible];
Question 1: the nib file for the main window (MainWindow.xlb) has the question view controller as an object (as well as the navigation controller). Does it need to be there?
Question 2: what should I change to make the new view controller the default view?
preguntado el 27 de agosto de 11 a las 21:08
- Yes, you need that connection otherwise you wouldn't be able to reference
questionViewControllerfrom the app delegate like you currently are. But if the
questionViewControlleris no longer your first view controller, you should replace it with a different one.
- Just like you already have, use
navController.viewControllers = [NSArray arrayWithObject:/*new first view controller*/];
Of course you'll also have to put it in the xib file and connect it to an IBOutlet so you can use it.