iOS UICollectionView prototype cell size property ignored

后端 未结 9 1937
花落未央
花落未央 2021-01-30 19:51

I\'m using a UICollectionView with two prototype cells. The prototype cells have different widths and contain different controls (image view and web view). I\'m definitely ret

9条回答
  •  南方客
    南方客 (楼主)
    2021-01-30 20:31

    I had a Similar Issue, I set a breakpoint on the sizeForItemAt and it was being called for every cell I had on my collection, however, the size set in code was never being reflected on the device.

    While looking at other collections in my project I noticed the Collection View Flow Layout was slightly different in the collection with the issue.

    By Selecting the Flow Layout in the Storyboard

    And then Setting the Cell Size & Estimate Size in the Size Inspector

    This helped me solve my issue.

    However the size of the cell will not be dynamic with what is in your sizeForItemAt

提交回复
热议问题