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,
Similar to @Sviatoslav answer, you can try the following:
- (void) viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
yourCollectionView.contentOffset = CGPointMake(0, 0);
}
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;
}
Swift 5.2 / Xcode 11.3
viewController.automaticallyAdjustsScrollViewInsets
has been deprecated since iOS 11.
My solution:
collectionView.contentInsetAdjustmentBehavior = .never