UICollectionView增加了上边距 [英] UICollectionView adds top margin

查看:271
本文介绍了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.

这篇关于UICollectionView增加了上边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆