I am new to objective c development and I have searched for the last couple days on how to solve this problem. Essentially, I am trying to create a main menu for my application that contains three buttons that will load different views depending on the button the the user hits. All of the tutorials I have seen only show one button and every time I add the second, my program crashes. Below is the code that I have put together for two buttons
The second view is working correctly and the buttons are being connected the same way. The problem starts when I try adding the third view. I have even tried adding two view controllers to direct them.
In the main.h
In the main .m
Thank you.
The second view is working correctly and the buttons are being connected the same way. The problem starts when I try adding the third view. I have even tried adding two view controllers to direct them.
In the main.h
Code:
@interface ViewViewController : UIViewController {
IBOutlet SecondViewController *secondViewController;
IBOutlet FourthViewController *fourthViewController;
}
- (IBAction)gotoSecondView;
- (IBAction)gotoFourthView;
In the main .m
Code:
- (IBAction)gotoSecondView{
[self presentModalViewController:secondViewController animated:YES];
}
- (IBAction)gotoFourthView{
[self presentModalViewController:fourthViewController animated:YES];
}
Thank you.