Using buttons, located on the same xib, to bring up different views
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 button is working correctly and the buttons are being connected the same way. I have even tried adding two view controllers to direct them.
The logic goes like this: Create a new view controller, present it, release it. You try to present it without having created it and your typing is messed up. Are addWorkOrderControllerV1 and OrderControllerV1 supposed to be the same? If yes, you have to use the same name. If not, you have to create addWorkOrderControllerV1 before you can do something with it.
Assuming they are the supposed to be the same, try
they are not the same. the user can chose one of two buttons on the current view, one the buttone will bring up a new view,WorkOrderControllerV1, and the other button will bring up another view, OrderControllerV1.
Sorry I am very new to this and I am trying to understand. As I search the internet it seems that this question has been asked and unanswered many times.
Okay, for what you want to do, you'll need two separate buttons (obviously) and two separate methods. (Well, not necessarily, but let's keep it simple.)
Use Interface Builder to create both buttons and then implement the following two methods in your .m file:
This, of course, assumes that you have actually created OrderControllerV1 and WorkOrderControllerV1 with its corresponding NIB files. Now you only need to connect the buttons with the IBActions (in Interface Builder).
Hope this helps.
Cheers,
Bob
__________________ We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.
The second button will not load correctly. It have tried writing this about 10 different ways and the best I have gotten it is that the second button will only go load to the mainmenu.xib.