I am attempting to set the height of a custom tableViewCell
, but the code below does not work. What is the better way to do this?
Programmatically:
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.rowHeight = 140
}
via storyboard:
tableView
-> size Inspector
-> set row height
to 140.I have also tried the following:
UITableViewCell
-> size Inspector
-> set row height
to 140.if you are using UITableViewController like this:
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 140.0
}
if you are using UIViewController, you must implement UITableViewDelegate
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 140.0
}