UICollectionView增加了上边距

UICollectionView增加了上边距

问题描述:

我想放置一个水平显示拇指的UICollectionView控件(只有一行拇指)。由于某种原因,UICollectionView将拇指向下推44像素,因此0高度实际上是44。我假设它可能会添加这个空间来考虑导航栏高度(我只是假设)。由于我的UICollectionView仅在屏幕的一部分上,我不想要这个边距。有没有办法删除它?

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, so the "0" height is actually "44". I assume it might be adding this space to consider the navigation bar height (I just assume). Since my UICollectionView is only on part of the screen, I don't want this margin. Is there a way to remove it?

问题可能出在集合视图的内容插入中。
尝试将 self.automaticallyAdjustsScrollViewInsets = NO; 添加到视图控制器的 viewDidLoad 方法中。

The issue may be in collection view's content insets. Try to add self.automaticallyAdjustsScrollViewInsets = NO; into view controller's viewDidLoad method.