如何设置tableViewCell的行高

时间:2016-11-13 20:22:55

标签: swift uitableview

我想以编程方式更改tableViewCell的高度, 我怎么能这样做?

我的TableView示例: -

enter image description here

1 个答案:

答案 0 :(得分:2)

在viewcontroller中通过以下方式设置行高:

tableView.rowHeight = 88.8

您还可以通过实施:

来设置单个行的行高
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    if indexPath.row == 0 {
        return 88.0
    }
    return 44.0
}