UICollectionViewCell gets hidden randomly

前端 未结 3 1203
耶瑟儿~
耶瑟儿~ 2021-01-03 10:36

I have a UIView in which I am adding a UICollectionView to act as a banner view to look like a carousel. The Viewcontroller in which UIView

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 10:45

    Same problem.

    Here's my situation:

    My collection view has a custom layout. I use the default flow layout without any problem.

    When I use my custom layout, whose cell width is a half screen width. When I scroll to the 5th cell, all cells became hidden without reason.

    Finally I found out that when I set cell's size correctly in the layout class of the storyboard, the problem is resolved.

    Hope this helps.

提交回复
热议问题