可能重复:
Why can't I push a new view controller onto the current view?
Why is my new view controller not appearing?如果我的navigationController返回“(null)”,我该怎么办?
我需要从我的navigationController推我的视图控制器,但毕竟已经做了的NSLog语句来找出为什么什么也没有用出下面的代码,我意识到它返回null:
-(IBAction)doChangePasscode{
NSLog(@"Change Passcode Screen Loaded!");
ChangePasscode *cpscreen = [[ChangePasscode alloc] initWithNibName:@"ChangePasscode" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:cpscreen animated:YES];
NSLog(@"%@",self.navigationController);
}
这是怎么发生的?我能做些什么来返回除(null)之外的适当值?
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:myRootViewController];
然后:
什么是你有这样的原始控制器代码在?它实际上是一个NavigationController吗? – WrightsCS
不知道,它只是叫做“ViewController.m”... – pixelbitlabs
你可以在上面的代码中显示你正在初始化和显示'self' view controller的代码吗? – chown