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?
UICollectionView makes adding custom layouts and layout transitions, like those in Photos, simple to build. You're not limited to stacks and grids because collection views are customizable. You can use them to make circle layouts, cover-flow style layouts, Pulse news style layouts and almost anything you can dream up!
You need to reduce the height of UICollectionView to its cell / item height and select " Horizontal " from the " Scroll Direction " as seen in the screenshot below. Then it will scroll horizontally depending on the numberOfItems you have returned in its datasource implementation.
There are no section headers in the UICollectionView. So for your first task, you'll add a new section header using the search text as the section title. To display this section header, you'll use UICollectionReusableView .
A layout object that organizes items into a grid with optional header and footer views for each section.
The issue may be in collection view's content insets. Try to add self.automaticallyAdjustsScrollViewInsets = NO;
into view controller's viewDidLoad
method.
You can set this in the storyboard too.
Make sure you've selected the ViewController, and then untick "Adjust Scroll View Insets".
I haven't tested what this IB/Storyboard method does on iOS6 though. With the code method you need to check that the VC responds to the method:
if ([self respondsToSelector:@selector(setAutomaticallyAdjustsScrollViewInsets:)]) { self.automaticallyAdjustsScrollViewInsets = NO; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With