Unable to set UICollectionViewFlowLayout headerReferenceSize

I am getting the following when setting layout.headerReferenceSize

Assertion failure in -[HLEventCollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:],

      

The failure occurs even before the data source is installed. CollectionView is a frame set for the bounds of viewControllers. FlowLayout has no properties other than headerReferenceSize.

example code:

- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];

UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
flowLayout.headerReferenceSize = CGSizeMake(0.0f, 30.0f);

UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:flowLayout];
[self.view addSubview:collectionView];

      

}

This happens regardless of whether the data source is installed or not.

+3


source to share





All Articles