Chapter 20. Creating the details of the detail view
This chapter covers
- Adding a detail screen to display the lion details
- Using Int values as a string
- Deleting lion objects from the list
You created the DetailViewController in the last chapter, and you were able to pass a lion object from the MainViewController to the DetailViewController and print the Lion name to the console. In this chapter, you’ll add labels to the DetailViewController scene so you can display the lion object for the user.
The first thing you’re going to do is create three labels on the detail screen and connect them to your code through IBOutlets. You’ve done this several times in the book, so it shouldn’t be new. Go into your storyboard, and drag three labels from the Object Library onto the DetailViewController scene. Drop them toward the top-left corner for now, and make them a little longer so they can display the lion details when you wire them up.
Next, open the Assistant Editor view (click the button at top right that looks like two interlocking circles). Control-click a label, drag it over to the DetailView-Controller.swift file, and drop it right under the class definition. Do this for each of the three labels, and name them like this:
- lblName
- lblDesc
- lblLike