[抱歉我的英语不好]
我有一些方法可以创建并显示一些新的视图控制器(在我的基础之上) 当前视图控制器级别)
- (void) switchToDifficultyMenu
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
DifficultyMenuController *difficultyMenuController = [[DifficultyMenuController alloc] init];
NSLog(@"navigation controller %@" , self.navigationController); //navContr is nil
[self.navigationController pushViewController: difficultyMenuController animated: NO];
[difficultyMenuController release];
[pool release];
}
当我从我当前的点击事件中触发它时它起作用 查看控制器,但当我尝试在我当前的视图控制器时立即调用它 在它的-viewdidLoad中导航(它是一些需要的)id est导航控制器是 零
我怎样才能让它发挥作用,tnx
答案 0 :(得分:3)
在您不将UIViewController
推送到UINavigationController
之前,navigationController
属性将为空。在推送之前始终调用viewDidLoad
方法。因此,在viewDidLoad
中,无法访问此属性。