Using ItemCell
Let’s get your custom cells onscreen. In ItemsViewController’s tableView(_:cellForRowAt:) method, you will dequeue an instance of ItemCell for every row in the table.
Now that you are using a custom UITableViewCell subclass, the table view needs to know how tall each row is. There are a few ways to accomplish this, but the simplest way is to set the rowHeight property of the table view to a constant value. You will see another way shortly.
Open ItemsViewController.swift and implement viewDidLoad() to set the height of the table view cells.
Listing 10.3 Setting a fixed row height (ItemsViewController.swift)
override func viewDidLoad() {
super.viewDidLoad()
tableView.rowHeight = 65
}
Now that you have registered ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access