UICollectionViewCells are resetting their size on refresh

Recently I was working on a scrollable tab bar, where I decided to use collectionview with estimatedSize as automatic as the tab titles were dynamic. I used a stackView inside the cell with all proper constraints and used the default flowlayout. Everything worked well unless there was a requirement to reload the tabs and what happened was once the reload happens, size of the cells became wrong, they shrinked suddenly. I could use the sizeForItem api but then I loose the dynamic behavior. Finally below are the steps that I did. I was creating the layout programmatically Set translatesAutoresizingMaskIntoConstraints false …

Continue Reading