UICollectionView adds top margin

bashan picture bashan · Oct 16, 2013 · Viewed 42k times · Source

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?

Answer

Sviatoslav Yakymiv picture Sviatoslav Yakymiv · Oct 16, 2013

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