Can anyone explain why UICollectionViewFlowLayout is adding extra space before the first section header in the following? The yellow border is the UICollectionView
frame. The blue borders are the UICollectionReusableView
section header frames:
The extra space is only appearing above the first section header, which is odd.
As far as I can tell, I'm zeroing everything out. This is how I instantiate the flow layout and collection view:
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
flowLayout.itemSize = [BCFriendCell defaultSize];
flowLayout.minimumInteritemSpacing = 0.0f;
flowLayout.minimumLineSpacing = 0.0f;
flowLayout.headerReferenceSize = CGSizeMake(kScreenWidth, 63.0f);
flowLayout.footerReferenceSize = CGSizeZero;
flowLayout.sectionInset = UIEdgeInsetsZero;
CGRect collectionViewFrame = ...
collectionView = [[UICollectionView alloc] initWithFrame:collectionViewFrame collectionViewLayout:flowLayout];
collectionView.contentInset = UIEdgeInsetsZero;
[self.view addSubview:collectionView];
NSLog(@"contentOffset: %@", NSStringFromCGPoint(collectionView.contentOffset));
That last logging line prints out the expected
2014-09-30 19:23:28.974 MyApp[4468:60b] contentOffset: {0, 0}
Thanks for the help.