简体   繁体   中英

Changing UITableView Cell's Height by using storyboard

I'm using Swift5 and Xcode 11.4.1 on macOS Catalina.

main.storyboard 主故事板图像

As you can see here, I selected tableview cell, went to the size inspector and changed the height as 100 and hit enter. It is successfully changed as 100 height on storyboard but when I run this thing,

Simulator screenshot模拟器截图

It looks like this, the image link above. The height is set as 44 not 100.

Add this method to the class that conform's to your UITableView 's delegate to change the tableView's height.

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    return 100
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM