Я просто создаю UITableview
(Второй UITableview
) внутри UItableviewcell
. Мне нужно увеличить UItableviewcell
высоту, основываясь на втором номере ячейки UITableview (вторая UITableview's
ячейка имела другую высоту).
1-й просмотр таблицы:
extension ViewController:UITableViewDelegate, UITableViewDataSource{
// no of row #1
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "OrderTimelineCell", for: indexPath) as! OrderTimelineCell
return cell;
}
}
1-я ячейка таблицы:
override func awakeFromNib() {
tableView.layoutIfNeeded()
tableView.heightAnchor.constraint(equalToConstant: tableView.contentSize.height).isActive = true //always return 44*#cells
}
extension OrderTimelineCell:UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TimelineTableViewCell", for: indexPath) as! TimelineTableViewCell
cell.label.text = array[indexpath.row] // text height different
return cell
}
}
Я ожидаю, что вывод отобразит все ячейки Second UITableview
внутри 1-ых UITableview
клеток.
но фактический результат - высота ячейки == #no ячейки * 44