Reputation: 688
I have this code that I believe should switch from one xib to another but it isn't working, no errors are occurring just nothing happens when I click on the button thats linked to the IBAction. Any ideas?
-(IBAction) startButton:(id) sender {
[[self navigationController] pushViewController:[[GameViewController alloc] initWithNibName:@"GameViewController" bundle:nil] animated:YES];
}
Any ideas?
Upvotes: 1
Views: 55
Reputation: 535606
It's because you are not in a navigation interface. Thus [self navigationController]
is nil, and a message to nil in Objective-C does nothing.
Upvotes: 1