How to make Supplementary View float in UICollectionView as Section Headers do in UITableView plain style

后端 未结 13 681
逝去的感伤
逝去的感伤 2020-11-27 09:35

I\'m struggling to achieve a \"floating section header\" effect with UICollectionView. Something that\'s been easy enough in UITableView (default b

13条回答
  •  -上瘾入骨i
    2020-11-27 10:22

    I've added a sample on github that is pretty simple, I think.

    Basically the strategy is to provide a custom layout that invalidates on bounds change and provide layout attributes for the supplementary view that hug the current bounds. As others have suggested. I hope the code is useful.

提交回复
热议问题