I’m trying to switch views in an iPhone application, but whenever I click on the button to bring up the second view, all I get is a blank screen, even though I’ve filled the view with buttons and whatnot.
I’ve checked the second ViewController in my storyboard file and its custom class is the one that it needs to be (When I originally created the second ViewController class a new interface file came with it, which I promptly deleted). What might I be doing wrong?
- (IBAction)Transition_NEXT:(id)sender
{
nextViewController = [[NextViewController alloc]
initWithNibName:@"NextViewController"
bundle:[NSBundle mainBundle]];
[self presentModalViewController:nextViewController animated:NO];
}
I don’t think you’re using Storyboards correctly. You shouldn’t be using
initWithNibName, as that’s the old method of instantiating a view controller. Try using the newinstantiateViewControllerWithIdentifierlike so:If you already have a reference to your storyboard in your controller, then you shouldn’t initialize a new one, but instead you should just use the reference you have.