I bumped into a problem where UIViewController.navigationController
into nil
and I m Weily seeking an response to this one.
The UINavigationController
have set up in the application delegation:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.rootViewController = [[RootViewController alloc] initWithNibName:@"RootView" bundle:nil];
UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:self.rootViewController];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}
当登上
- (void)viewWillAppear:(BOOL)animated {
NSLog( @"self = %@, self.navigationController = %@", self, self.navigationController );
[self.navigationController setNavigationBarHidden:YES animated:NO];
}
缩略产出显示<代码>本身和本身.navigationController
的数值。
当该控制器点击ton子时,自行
www.un.org/Depts/DGACM/index_french.htm
- (IBAction)buttonClicked:(id)sender {
NSLog( @"self = %@, self.navigationController = %@", self, self.navigationController );
// here, self.navigationController is nil, so
// [self.navigationController pushViewController:...] doesn t work :-(
}
我看到了数十个有关这个问题的问题,答案始终是<代码>。 UIViewController不是< IDNavigationController>的一部分。 由于进入<代码>navigationController>,viewWillAppear
,我认为有必要做其他事情。 你们是否有任何点? 我很乐意在必要时提供更多细节。