开发者

problem with navigationController

[sorry for my weak english]

I have some method to create and show some new view controler (on top of my current view controler level)

- (void) switchToDifficultyMenu
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

 DifficultyMenuController *difficultyM开发者_JAVA技巧enuController = [[DifficultyMenuController alloc] init];

   NSLog(@"navigation controller %@" , self.navigationController); //navContr is nil

 [self.navigationController pushViewController: difficultyMenuController animated: NO];

 [difficultyMenuController release];
[pool release];  


}

it works when i fire it for example from under tap events on my current view controller, but when i try to call it immediately when my current view controler loads (it is some need for that) id est in its -viewdidLoad the navigationController is nil

how can i make it work, much tnx


Until you don't push your UIViewController into an UINavigationController, the navigationController property will be null. The viewDidLoad method is always called before the push. So in the viewDidLoad, there is no way to access this property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜