Automatically increase/decrease UILabelView Height in UITableViewCell?

后端 未结 2 712
挽巷
挽巷 2021-01-27 17:53

Hello I have a UITableView with x# of cells. the last cell I have two UILabels. When the second UILabel text is set I am trying to get the cell and the UILabel to resize to sh

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-27 18:38

    1. Set tableView.rowHeight = UITableViewAutomaticDimension
    2. Remove this function in your code func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
    3. Set height constraint of LabelBio greaterOrEqualThan 0

提交回复
热议问题