I'm new to programming on Xcode and can't really find out how to call the SecondViewController
window by pressing a button. The button is called Ingredients; I tried entering "-(IBAction)Ingredients:(id)sender;
in the ViewController.h
and but then saw that there was the FirstViewController.h
and SecondViewController.h
, same with First and second ViewControllers
.
Anyways, what I wanted to do was be able to click the "Ingredients" button and make it go to a completely different window, with a different background, and other texts as the first one. I'm not sure if I'm explaining myself correctly :(. Let me try an Image:
First of all, get some basic knowledge about Objective C
. Go to Apple developer website and you will get tons of tutorials & sample codes to learn.
Now, for your question:-
In firstViewController.m
First import SecondViewController.h
On button click:-
SecondViewController *secondVC = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self.navigationController pushViewController:secondVC animated:YES];