Why does didLoad not fire?
I have a startup view 开发者_如何学运维controller which has the following:
- (void)viewDidLoad {
[self loadMainMenu:nil];
[super viewDidLoad];
}
This does the following:
-(IBAction) loadMainMenu:(id) sender {
[self.view insertSubview:mainMenuViewController.view atIndex:0];
}
My mainMenu.h has the following:
-(IBAction) loadRules:(id) sender;
-(IBAction) loadPlayGame:(id) sender;
-(IBAction) loadHighScores:(id) sender;
-(IBAction) loadAbout:(id) sender;
mainMenu.m has the below and has a button tied to this in order to show the view:
-(IBAction) loadPlayGame:(id) sender {
playGame *playGameViewController = [[rules alloc]
initWithNibName:@"playGame"
bundle:nil];
[self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentModalViewController:playGameViewController animated:YES];
[playGameViewController release];
}
Now the View for playGame does come up but the viewDidLoad never gets hit.
What am I doing wrong? Is this not the way to load the view? As always, thanks in advance for any and all help.
BTW: The code: [self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; does nothing...any and all view show up as a croll up from bottom.
Geo...
This code makes no sense:
playGame *playGameViewController = [[rules alloc]
initWithNibName:@"playGame"
bundle:nil];
What is rules
here? Is it a instance variable? It should the the class name of a view controller. Like for example PlayGameViewController
.
Either you are doing that wrong or your naming conventions for classes and nibs are very wrong.
精彩评论