UICollectionView provides callbacks -
Whenever supplementaryView is displayed
- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
Whenever a supplementaryView scrolls from the screen -
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
You need to look for the elementKind parameter elementKind . It has two values: UICollectionElementKindSectionHeader and UICollectionElementKindSectionFooter .
I believe that you need to make your settings using the UICollectionElementKindSectionHeader .
Hope this helps.
UPDATE:
If the UICollectionView does not provide a way to configure this on the fly, as described above, the recommended approach would be to develop a UICollectionElementKindSectionHeader in the storyboard itself.
All you have to do is drag the UICollectionReusableView inside the collectionView into the view hierarchy. You may also need to set up a custom subclass for this and add IBOutlet connections to the various components of the user interface.
source share