[英]How to create dynamic cell in tableview (without custom cell)?
I have created UITableView
with default cell.imagview
, cell.textLabel
and cell.detailTextLabel.text
. 我已经使用默认的
cell.imagview
, cell.textLabel
和cell.detailTextLabel.text
创建了UITableView
。
I want to set cell dynamic according to content. 我想根据内容设置单元格动态。 I am able to set it dynamic only for either
TextLabel
or detailTextLabel
. 我只能将其动态设置为
TextLabel
或detailTextLabel
。 But to for both at same time. 但是要同时为两者。
Is there any way to do that? 有什么办法吗?
@sss You need to return height of every cell in datasource method heightForCell at index path. @sss您需要在数据源方法heightForCell中的索引路径处返回每个单元格的高度。 so You need to calculate the height of the cell in that datasource method for every index path.
因此,您需要在该数据源方法中为每个索引路径计算单元格的高度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.