在 appDelegate 中,我创建了一个 A_NavigationController 成为 self.window.rootViewController,并设置一个 X_ViewController 成为 rootViewController,在另一个 viewController 推送后,我创建一个新的 B_NavigationController ,设置一个新的 Y_ViewController 成为 rootViewController 并使用 presentModalViewController 方法,添加了 B_NavigationeController。现在我想做的是,当我解散 Y_ViewController 时可以改变 A_NavigationController 的 rootViewController。
self.viewController = [[AViewController alloc] initWithNibName:@"AViewController" bundle:nil];
self.navCon=[[UINavigationController alloc]initWithRootViewController:self.viewController];
self.window.rootViewController = self.navCon;
BViewController *bView=[[BViewController alloc]initWithNibName:@"BViewController" bundle:nil];
UINavigationController *navCon=[[UINavigationController alloc]initWithRootViewController:bView];
[self.navigationController presentModalViewController:navCon animated:YES];
//in BViewController.m
//I want a method to change the window's rootViewController.