Home / IOS Development / Does anyone know how to dynamically resize cell width based on content using UICollectionViewCompositionalLayout: iOSProgramming

Does anyone know how to dynamically resize cell width based on content using UICollectionViewCompositionalLayout: iOSProgramming



Giving a proper size in UICollectionViews cell is pain as ass.

Fortunately, iOS gives us UICollectionViewCompositionalLayout.

But we still can not make it work based on our requirements.

We would like to achieve the same on a horizontal UICollectionView, with requirements

  1. Fixed height 44

  2. Minimum width 44

  3. The width should be increased dynamically as the content grows

We tried https://stackoverflow.com/questions/63669680/attempt-to-achieve-fixed-height-dynamic-width-wrap-content-horizontal-uicolle, but it did not work.

Does anyone have any idea how to correct this? Thanks.


Source link