william205
william205

Reputation: 688

switching xib's objective c iOS 7

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

Answers (1)

matt
matt

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

Related Questions