I apologize in advance for a likely simple question. I am using XCode 4.4 and am trying to simply call a 2nd view controller when a button is pressed to show info about my app. I have created a 2nd view controller (SecondViewController) and seem to have the appropriate .h and m files. I added a view controller to the storyboard and changed the view controller’s class to SecondViewController.
On the fist view controller, i simply have a button that calls the showSecond Method i created.
When I execute the app via the simulator and press the button on the first view controller, the screen flips as expected but it goes to a black screen and not the screen I customized in the storyboard scene.
Here is the code snippet from the initial view controller.m file:
-(IBAction)showSecond
{
SecondViewController *controller = [[SecondViewController alloc] init];
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:controller animated:YES completion:nil];
}
Following a tutorial, I was able to get this to work without the storyboard method, but it required a slightly different init function as it references a xib file. I am trying to use storyboards as much as possible and am new to xcode programming.
Thanks,
Jeffrey
Here is a really easy way to show another view with a button. Add another UIView Controller to your storyboard. Then right click on the button from the first view and drag the connection to the second view.