Implementing the Restaurant Detail screen

As shown in the app tour, when you tap a restaurant in the Restaurant List screen, a Restaurant Detail screen containing the details of that restaurant will appear. Tapping the Add Review button will display the Review Form screen where you can add reviews.

In this section, you'll add a new table view controller scene to your storyboard to represent the Restaurant Detail screen and add a second view controller scene to represent the Review Form screen. You'll place a button in one of the table view cells to present the second view.

Let's start by adding the new view controller scene. Go through the following steps:

  1. Click the Object library button, search for table, and drag a Table View Controller object to the storyboard next to the Restaurant List View Controller Scene:

  1. This is what the Table View Controller Scene looks like. Note that it already has a Table View inside it:


  1. To display the Restaurant Detail screen when a cell in the Restaurant List screen is tapped, press and hold Ctrl and drag it from restaurantCell (inside the Restaurant List View Controller Scene) to the Table View:


  1. Select Show from the pop-up menu:


  1. A segue will appear between the two scenes:


  1. Click Table View in the document outline of the Table View Controller Scene and click the Attributes inspector:


  1. Set Content to Static Cells:


We're doing this because the Restaurant Detail screen always uses the same number of cells to display restaurant details. Build and run your app. Click on a cell in the Explore screen. Then, click on a cell in the collection view to display the Restaurant Detail screen:

Click the Back button to go back.

In the next section, you will implement a button inside one of the table view cells to display a Review Form screen.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.237.79