Reputation: 2819
I have an application where I have a ViewController in my storyboard file. I have added a button to this viewController that should call another ViewController that is outside of the storyboard and has with it, it's own .xib file. However, when I press this button, the method is being called, but the new screen is not being loaded, and I don't know why.
Here is the relevant code that I have below:
- (IBAction)showTireCount:(id)sender {
NSLog(@"do i get called?");
SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self.navigationController pushViewController:secondView animated:YES];
}
I am able to see the text "do i get called" appear in the system output, but unfortunately nothing else occurs. Can anyone see what it is I am doing wrong?
Upvotes: 1
Views: 862
Reputation: 38162
Make sure you are having the below statement inside SecondViewController initialize method
[super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
Upvotes: 0
Reputation: 9311
self.navigationController is nil. Did you embed your view controller (the one with the button) in a UINavigationController?
Upvotes: 2