0
votes

I have the UITableView with UITableViewCell, which contains UICollectionView, as:

  • UITableViewCell
  • UITableViewCell
    • UICollectionViewCell
    • UICollectionViewCell

In UICollectionView data is adding dynamically. I have subscribed to UICollectionView contentSize and I am changing frame of UICollectionView accordingly to contentSize. It's working fine and frame of UITableViewCell containing UICollectionView is changing correctly, but UITableView contentSize does not updating. And I don't understand why?

UITableView items height is set to UITableViewAutomaticDimension

1
Please provide some code as an example :-) - Grumme
I don't even know what provide to.. ``` collectionView.rx.contentSize .subscribe(onNext: { [collectionView] contentSize in guard let collectionView = collectionView else { return } collectionView.frame = CGRect(origin: collectionView.frame.origin, size: contentSize) }).disposed(by: bag) ``` - Gikas
I have subscribed to UICollectionView contentSize and I am changing frame of UICollectionView accordingly to contentSize What is the reason of doing that? - arturdev
@arturdev In order to UITableView recalculate own contentSize automatically, as well as when we have UITableViewCell with single UILabel (top, bottom, leading, trailing constraints) and when UILabel is expanding, UITableViewCell and contentSize expanding accordingly - Gikas
@Gikas Can you provide a screenshot of the desired result? - arturdev

1 Answers

0
votes

The best solution I've found. This is to do the calculation of height manually, without using UITableViewAutomaticDimension.

Yes, you have to spend a time for writing this.

After each added element of the UICollectionViewCell, you need to make an update your tableView (depending on what suits you):