You’ll want to embed these two TableViewControllers
in a Navigation controller.
You can do this in storyboard:
-
Select the
TableViewController
with the first table in it -
In Xcode’s menu bar: Editor > Embed In > Navigation controller
-
Create another
TableViewController
in the storyboard. -
Ctrl+Drag a storyboard segue from a
TableViewCell
on the firstTableViewController
to the secondTableViewController
. Like @hw731 said, this will indicate that when a cell is tapped it will invoke the segue to the new TableViewController.
–Now move to code.
-
In the .m file for that first view controller you can pass whatever data you want to pass to the second VC. (like, the fact that they chose dog)
-
In the
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
method:- Grab the reference to the second view controller like so:
SecondTableViewController *secondTableVC = segue.destinationViewController
- Now you can say
secondTableVC.arrayOfItemsToDisplay = dogsArray;
- Grab the reference to the second view controller like so:
There are some interim steps in there like creating the class for the second TableViewController and connecting it. Hope this helps!