具有嵌套表视图的静态表格单元格的动态高度

时间:2015-07-08 15:13:23

标签: ios uitableview storyboard autolayout tableviewcell

对于标签,在设置约束和

后,单元格将自动调整其高度
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 60.0

但是我有一个静态表,在其中一个单元格中,我有一个内部表视图

i just drag a table view into the cell and bind it with data

具有名称标签的单元格#1将在文本足够长时展开。 但是单元格#5没有扩展到内部表的整个高度。

任何方式我都可以使用自动布局来处理表格吗?

it should list out "user 1", "user 2"

1 个答案:

答案 0 :(得分:-1)

您可以调用heightForRowAtIndexPath委托协议来调整外部tableView的行的大小。我不确定你是如何调整内部表格视图的,所以我不能更具体地说明如何计算相关行的大小。

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/#//apple_ref/occ/intfm/UITableViewDelegate/tableView:heightForRowAtIndexPath