Iglistkit: Inset is not working for SupplementaryView

Created on 28 May 2017  路  6Comments  路  Source: Instagram/IGListKit

I used self.inset = UIEdgeInsetsMake(0.0, 25.0f, 0.0f, 25.0f);
and

  • (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind
    atIndex:(NSInteger)index
    {
    return CGSizeMake(self.collectionContext.containerSize.width-50, 50);

}
screen shot 2017-05-28 at 8 55 03 pm

Thanks in advance

question

Most helpful comment

@Shivaprasad2452 @ninokierulf

Section insets are applied to contents only in UICollectionViewFlowLayout.

See Using the Flow Layout of the Apple official documentation for more details.

All 6 comments

@Shivaprasad2452 what UICollectionViewLayout subclass are you using?

I am using UICollectionViewFlowLayout

below is the code snippet

  • (UICollectionView *)collectionView {
    if (!_collectionView) {
    UICollectionViewLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
    _collectionView.backgroundColor = [UIColor whiteColor];
    }
    return _collectionView;
    }

+1

EDIT:
I have a supplementary view, I added a top inset, the top inset was applied below the supplementary view, I'm guessing the inset is applied to the cell collection part of the collectionview

@Shivaprasad2452 @ninokierulf

Section insets are applied to contents only in UICollectionViewFlowLayout.

See Using the Flow Layout of the Apple official documentation for more details.

looks like its default behaviour of iOS.
thanks @flybrotherlixiang

then how do I apply insets to header view?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rnystrom picture rnystrom  路  3Comments

lucabartoletti picture lucabartoletti  路  3Comments

Przemyslaw-Wosko picture Przemyslaw-Wosko  路  3Comments

alexwillrock picture alexwillrock  路  3Comments

iwasrobbed picture iwasrobbed  路  3Comments