Removing empty space, if the section header is hidden in the UICollectionView
问题 I have two sections in UICollectionView . I want to show a section header in UICollectionView for only 1st section. Not in 0th section. So I tried to return nil in viewForSupplementaryElementOfKind : method for section == 0 and returns view for the section == 1 . It crashes and shows below error: Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes]: Here it is my code for the supplementary view. -