Table View Cell Row Height doesnt work

前端 未结 8 1033
故里飘歌
故里飘歌 2021-02-05 03:39

I have tried to hard code the row height in the table view cell. After running the program it looks like only one line. I suspect it is because of the height of the row

相关标签:
8条回答
  • 2021-02-05 04:05

    You can manually do it in your tableviewdelegate:

    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 100
    }
    
    0 讨论(0)
  • 2021-02-05 04:07

    In Xcode 9, tableview automatically create estimated cells based on Autolayout. Since you have not provide autolayout, that's why you are getting this.

    You need to disable estimated and automatic cell size by selecting tableview and uncheck the two options:

    Give value you want to Row height, and cell will be created accordingly.

    Hope this can help.

    0 讨论(0)
提交回复
热议问题