Tableview to Tableview

You’ll want to embed these two TableViewControllers in a Navigation controller.

You can do this in storyboard:

  1. Select the TableViewController with the first table in it

  2. In Xcode’s menu bar: Editor > Embed In > Navigation controller

  3. Create another TableViewController in the storyboard.

  4. Ctrl+Drag a storyboard segue from a TableViewCell on the first TableViewController to the second TableViewController. 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.

  1. 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)

  2. 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;

There are some interim steps in there like creating the class for the second TableViewController and connecting it. Hope this helps!

Leave a Comment