1

Keypoints:

  1. I am using XIB with Autolayout

I am trying to create a UICollectionView that has a dynamic item height. This is needed because I have an UILabel that might have different heights due to it's length. The UILabel's text is set using it's attributedText property

I am aware that:

  1. I MUST NOT implement sizeForItemAtIndexpath.
  2. I MUST set estimatedItemSize to the flowLayout of my UICollectionView.

I have been scavenging Stackoverflow for more than 6 hours but still unable to find solution but most of the solutions are either emphasizing on Storyboards or intended for lower version of iOS.

The best one i have found so far is this UICollectionView Self Sizing Cells with Auto Layout

However, that also did not fix my problem because somehow, my cell does not have the intended width.

Any ideas please?

.

.

Please help me vote this up cause I am literally banging my head now. Any help is very welcome.

Community
  • 1
  • 1
JayVDiyk
  • 6,250
  • 20
  • 61
  • 113

0 Answers0