In the Table View Cell I have a vertical Collection View. How can I make the height of the cell be equal to the height of the Collection View and not cut it off?

    1 answer 1

    • If the height of the UICollectionView is always the same, then in IB (Interface Builder) you can set the height of the cell. Or in the code specify rowHeight.
    • If the height of the UICollectionView is always different, then the delegate of the table (UITableViewDelegate) must return the correct height for each table cell of the delegate method.

    Ps. If you use autolayout for a UITableViewCell, you can use an automatic height calculation. To do this, you must determine the approximate height of each cell and enable automatic counting.

    tableView.rowHeight = UITableViewAutomaticDimension tableView.estimatedRowHeight = 140 // примерная высота ячейки