问题描述
我想放置一个水平显示拇指的 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.
这篇关于UICollectionView 添加上边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!