cell根据文本标签内容自适应高度
2017-12-16 19:28
337 查看
cell里面的label不能有固定高度,只能添加上下左右的约束,并且只能存在唯一一个这样设置的label,可以有其他view,但其他view需要有明确的高度
label需要属性numberOfLines = 0 和adjustsFontSizeTofitWidth = true
代理设置:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
tableview设置:
label需要属性numberOfLines = 0 和adjustsFontSizeTofitWidth = true
代理设置:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
tableview设置:
tb_rule.rowHeight = UITableViewAutomaticDimension tb_rule.estimatedRowHeight = 80
相关文章推荐
- ios 文字 控件 自适应 高度 宽度 CustomCell 自适应高度+uilabel自动换行+ UITextView 根据内容自动调整高度
- 根据文本内容计算cell的高度
- 根据文本内容快速自适应控件的宽度和高度
- ios开发笔记之如何让tableView根据文本内容动态改变cell的高度
- Jquery实现textarea根据文本内容自适应高度
- Jquery实现textarea根据文本内容自适应高度
- cell的自适应 根据cell上面的内容 动态返回cell的高度 还有利用NSMutableAttributedString 做出效果
- iOS UILable根据文本内容自适应高度
- ios根据内容设置cell的高度
- iframe根据内容自适应高度
- 源码推荐(5.05):快速集成版本新特性介绍页面,可以横向展示文本内容的自定义cell,根据文本无限滚动
- 最简单的方式让iframe根据内容显示高度即自适应高度
- [置顶] UILabel根据文本、字体大小计算label宽度;以及自适应高度
- 关于textView根据输入内容自适应高度
- 【iOS】根据文本内容确定文本框高度
- 根据文本内容自动计算文本高度
- cell根据文本长度来自动调整cell高度
- 文本框根据输入内容自适应高度
- Textarea 高度自适应 根据内容自适应高度
- 22.UITableViewCell根据Cell的内容自适应