Setting up the Restaurant cell

The Restaurant cell that we are setting up has many elements, so make sure to take your time. Make sure that you go to the Restaurant View Controller; let's get started:

  1. Select the prototype cell, called restaurantCell, in the Attributes inspector, and update the background color to white. Then, in the Size inspector, change the Size from Default to Custom:

  1. Then, update the following values:
    • Width: 375
    • Height: 312
  2. In the filter field of the object library, type view.
  3. Drag a View into the prototype cell.
  4. With the View selected, update the following values in the Size inspector:
    • X: 75.5
    • Y: 245
    • Width: 224
    • Height: 56
  1. Type label in the filter field.
  2. Drag a Label into the View we just added.
  3. With the Label selected, update the following values in the Size inspector:
    • X: 0
    • Y: 2
    • Width: 224
    • Height: 21
  1. In the Attributes inspector, update the following values:
    • Text: Add Available Times into the empty text field under the Text
    • Color: Black Color
    • Alignment: Center
    • Font: Avenir Next Condensed Bold 17

           When you are done, you should see the following:

  1. Next, in the filter field of the object library, type button.
  2. From the Object library, drag the button from the into the View where we have the label.
  1. With the button selected, update the following values in the Attributes inspector:
    • Type: System
    • Title: Plain and then add 7:30 pm in the empty text field under the Title
    • Font: Avenir Next Condensed Regular 17
    • Text Color: White Color
    • Background: time-bg
  1. In the Size inspector, update the following values:
    • Width: 68
    • Height: 27
  1. Select the button in the Outline view and hit command + C to copy.
  2. Hit command + V twice to paste. You should now have three buttons.
  3. Using the Outline view,  command + click each button created and click on the Embed in View icon. The stack icon is two icons to the left of the Pin icon:
  1. Select Stack View in the dropdown:

  1. Select the stack view in the Outline view, and update the following values in the Attributes inspector:
    • Axis: Horizontal
    • Alignment: Fill
    • Distribution: Equal Spacing
    • Spacing: 10
  1. In the Size inspector, set X to 0 and Y to 29.
    When you are done, you should see the following:

  1. In the filter field of the Object library, type view.
  2. Drag a View into the prototype cell.
  3. With the View selected, update the following values in the Size inspector:
    • X: 11
    • Y: 42
    • Width: 353
    • Height: 200
  1. Type image in the filter field.
  2. Drag out an Image view into the View we just added.
  1. Select the Image view in the Outline view and update the value of Image in the Attributes inspector with american. We are just using this image as a placeholder to see that our cells are set up correctly. Later, we will remove this and load the images using code. 
  2. With the Image view selected, update the following values in the Size inspector:
    • X: 0
    • Y: 0
    • Width: 353
    • Height: 200
  1. Type label in the filter field.
  2. Drag two Labels into the prototype cell.
  3. Select one of the Labels and update the value of Font in the Attributes inspector with Avenir Next Condensed Demi Bold 17.
  1. In the Size inspector, update the following values:
    • X: 10
    • Y: 3
    • Width: 355
    • Height: 19
  1. Select the other Label and update the following values in the Attributes inspector:
    • Color: LetsEat Dark Grey
    • Font: Avenir Next Condensed Regular 14
  1. In the Size inspector, update the following values:
    • X: 10
    • Y: 22
    • Width: 355
    • Height: 16

We have completed our Restaurant cell setup, and it now looks like the following:

Now we need to add Auto Layout to all of the elements.

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

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