UICollectionView adds top margin

前端 未结 9 1684
走了就别回头了
走了就别回头了 2020-12-04 14:06

I want to put a UICollectionView control that shows thumbs horizontally (only a single line of thumbs). For some reason the UICollectionView push the thumbs 44 pixels down,

9条回答
  •  难免孤独
    2020-12-04 14:36

    I found that adding:

    self.edgesForExtendedLayout = UIRectEdgeNone;
    

    In the view controller I was loading the UICollectionView in solved the problem as I couldn't get the accepted answer to work.

    The question I found this answer to can be found here and provides an extremely in-depth and interesting explanation of the difference between automatically adjusted scrolled view insets, extended layouts and edge for extended layouts.

    Well worth a read

提交回复
热议问题