我在 appDelegate 创建了一个自定义导航控制器:
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
poemsView = [[[PoemsViewController alloc]initWithNibName:@"PoemsViewController" bundle:nil] autorelease];
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:poemsView] autorelease];
self.navigationController.navigationBarHidden = YES;
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
所以问题是我需要来自 viewController 的应用程序午餐,但是如果我将 viewController 设置为 rootviewController,我的导航控制器不会推送导航,反之亦然,如果将我的导航控制器设置为根,则应用程序不会从菜单或主视图加载控制器 。