更改tableView单元格的高度不起作用

时间:2019-06-17 12:37:59

标签: ios swift uitableview

您好,我现在拥有UITableViewCell的人应该具有动态身高,该单元格具有3个标签,我已经将它们添加到堆栈中,并且添加了所有要求 让tableViewCell为动态高度

1-用于自动像元高度的代码

notifications.rowHeight = UITableView.automaticDimension

notifications.estimatedRowHeight = 150

2-我为superView设置了前导,尾随以及底部和顶部空间的约束。

3-每个标签的行数等于零

这是运行前的单元格 enter link description here

运行https://ibb.co/5YCMpfK后的此单元格

2 个答案:

答案 0 :(得分:0)

  1. 检查您的堆栈视图是否没有height constraint

  2. 检查您的标签是否没有任何height constraint

  3. 为您的stackview顶部约束和底部约束赋予一个特定值,并使它们大于topContraint >= 5 bottomconstraint >=5

  4. 将堆栈视图的属性更改为Fill proportionally并根据需要提供spacing

答案 1 :(得分:0)

您的from django.template.loader import render_to_string message = render_to_string('path_to_your_template.html', { 'domain':current_site, 'email': request.user.email, 'data' : your_data }) send_message = EmailMessage(mail_subject, message, to=[to_email]) send_message.content_subtype = "html" send_message.send() 中的constraints必须类似于:

enter image description here

tableViewCell的属性:

  1. stackView:垂直
  2. Axis:填写
  3. Alignment:按比例填充
  4. Distribution:5(根据您的要求)
所有3 Spacing = 0

中的

行数