I have a project with a NavigationController, that contains into IB the first ViewController to show. That's just the default pattern when creating the project.
In that first viewController, I receive some event that I send to the appDelegate, and I want it to replace that rootview with another one. Not going to a next one.
So I do :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the navigation controller's view to the window and display.
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
- (void) goNext {
[self.navigationController popViewControllerAnimated:NO];
NextViewController* nextWindow = [[[NextViewController alloc] initWithNibName:@"NextView" bundle:nil] autorelease];
[self.navigationController pushViewController:nextWindow animated:NO];
}
But that doesn't work, the first viewcontroller is not poped.
And the second one is logically displayed with a back button.
I just want to replace that first view with the other one as the start of the navigation process.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…